ConpSci - Program Construction Flashcards
(6 cards)
Compilation Process - Lexical Analysis
Comments and whitespace are removed
Keywords, variables and constants are replaced by tokens
A symbol table containing the addresses of variables, labels and subroutines
Compilation Process - Syntax Analysis
Tokens are checked against syntax rules of the language, if syntax errors are found, error messages are produced
Compilation Process - Semantic Analysis
Variables are checked to ensure they are correctly declared, used and data type
Operations are checked to ensure they are valid (quotient not stored as integer)
Compilation
Compilation only needs to occur once
Can be used by any device without any extra software
Hardware dependent
Faster
Intellectual property protected
Interpretation
Debugging is easier
Must be interpreted on every execution
Not hardware dependent
An interpreter is needed to run
Slower
Assembly
One-to-one translation from assembly (low level code) to machine code.
Using assembly provides more control over memory and storage
Less processing required to run
Difficult to learn and complex programs