This note continues from: Compilers
After the preprocessing produces a single source file in high level language , Translation of this source code can now occur.
Translation is the process of converting the High Level Language’s source code to object code.
It involves:
| Analysis stage | Description |
| Lexical analysis | Breaking the source code correctly into tokens |
| Syntax Analysis | Ensuring that the grammatical rules of the language are obeyed |
| Semantic analysis | Ensuring that the program statements make logical sense by adhering to the rules of the language. |
After the steps above are completed, we are left with some output: data structures and used in analysing the source code for errors, and if no errors were found, intermediate object code.
| Output | Sub Stage |
| A symbol table | Lexical analysis |
| A parse tree | Syntax Analysis |
| An annotated abstract tree | Semantic analysis |
| Unoptimized Object Code | Intermediate code generation |
| Optimized Object code | Code Optimization |
© 2024 Vedesh Kungebeharry. All rights reserved.