Translation (Program Translation During the Compilation process)

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 stageDescription
Lexical analysisBreaking the source code correctly into tokens
Syntax AnalysisEnsuring that the grammatical rules of the language are obeyed
Semantic analysisEnsuring 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.

OutputSub Stage
A symbol tableLexical analysis
A parse treeSyntax Analysis
An annotated abstract treeSemantic analysis
Unoptimized Object CodeIntermediate code generation
Optimized Object codeCode Optimization

© 2024  Vedesh Kungebeharry. All rights reserved. 

Leave a comment