Flashcards
Computer Science - Unit 4: Software - 4.2 - Compilation Stages
Cards in this deck (6)
- 1Lexical Analysis- keywords are replaced by tokens (e.g. if, while, for)
- comments and unneeded spaces are removed - 2Symbol Table Construction- table created - holds variable addresses, labels and subroutines
e.g. myNum -> memoryAddress 143 - 3Syntax Analysis- does the code match the rules (syntax) for the language used (e.g. does every open bracket have a close bracket)
- no > produces a syntax error - 4Semantic Analysis- Check if variables are properly declared and used - ensure they have the same data type
- operators checked to see if legal
e.g. 5/3 can not be stored as an integer - 5Code Generation- Machine code is generated
- 6Optimisation- makes code more efficient (e.g. replaces repeats with loops)
- determined by quality of compiler