Created by pstevens1963
about 9 years ago
|
||
Question | Answer |
Translator | Converts Source Code into Object Code A translator can be an assembler, compiler or interpreter |
Source Code | Written by the programmer in high level language |
Machine Code | Uses Binary Notation Architecture Specific Each instruction uses Bytes of data |
Object Code | Low Level Machine Code produced by the translator |
Assembler | Converts source code written in assembly language to machine code |
Executable Code | A complete program that can be run by the computer in machine code |
Assembler Again | Translates program from Assembly Language into Machine Code (one Assembly Code instruction to one Machine Code instruction) |
Assembly Language | Specific to Microprocessor LDA – Load Accumulator STR A – Store Accumulator ADD A – Add to Accumulator CPM A – Compare with Accumulator JMP – Jump to Label |
5 Features of an Assembler | S – Allocate Storage for Data and Instructions S – Create a Symbol Table so Label have physical addresses O – Convert Opcodes to Machine Code S – Check syntax of program code S – Symbolic Addressing given physical memory address |
Compiler | Translates whole program in one go Creates Executable Code Reports errors at the end of the process |
Interpreter | Translates program one line at a time Each line is run before translating the next line Reports errors |
Compiler Disadvantages | Program development usually slower Not easy to debug errors Uses more memory |
Interpreter Disadvantages | The end user has to be given the source code Program runs more slowly since each line is interpreted one at a time The end user needs the interpreter software |
Intermediate Code | Partly translated code |
Intermediate Code Disadvantages | Runs more slowly than executable code Sections of programs can be written in different languages Requires an Interpreter |
Virtual Machine | A generalised computer on which a computer program can run |
Features of Lexical Analysis | Source program is the input Tokens Created from symbols and reserved words Variable names placed in a symbol table Redundant characters are removed (spaces and comments) Errors reported Prepares code for Syntax Analysis |
Features of Syntax Analysis | Accepts output from Lexical Analysis Program statements are checked against the rules of the language Errors reported Data added to the symbol table (eg data Type) Output passed to code generation |
Code Optimisation | Is part of code generation Makes code as efficient as possible Increases processing speed Reduces file size by reducing number of instructions |
Code Generation | Produces machine code or executable code |
Example Tokens | Reserved Words (IF THEN ELSE) Symbols () + - * & / |
Library Routine | A wide range of useful functions that a programmer can use Created by the developers of compiler software |
Library Routine Advantages | Error free code - reliable Reusable – perform common tasks Allow programmer to write more sophisticated code using other programmers expertise Routines are already compiled |
Library Routine Disadvantages | Library routines need to be kept up to date- different versions in use by the same program can cause a program to crash |
Linker | Combines library routines that are already compiled with the program |
Loader | Copies library routine from secondary storage ready for execution Sets up link addresses |
How are Library routine used by CPU | Linker used to link library routine with program Loader handles physical addresses when the program is run |
Common Library Routine tasks | Searching and Sorting |
DLL | Dynamic Link Library |
How are Library routine used by programmer | Promotes program development in modules Easier to maintain programs |
High level Language Examples | Visual Basic Pascal C++ Java |
High Level Language that uses an Interpreter | Java |
Use of Labels | Used in assembly language. These are the memory addresses Eg: Loop1: |
Symbolic Addressing Example | LDA n (where n is the symbolic address) |
Want to create your own Flashcards for free with GoConqr? Learn more.