Translation in Compiler Design

Estudies4you
Translation
  • A translator is used to translate a high level language program into efficient executable code
  • It divides the translation process into a series of phases
  • Each phase manages some particular aspect of translation
Phases of Translation
The phases of translation are as follows
  • Syntax analysis
  • Semantic analysis
  • Intermediate code generation
  • Optimization
  • Final code generation

Syntax Analysis Phase
It is used to recognize the "sentences" in the program by using the syntax of the language
Semantic Analysis Phase
It infers information about the program by using the semantics of the language
Intermediate code Generation Phase
It generates "abstract" code based on the syntactic structure of the program and the semantic information from phase 2
Optimization Phase
It refines the generated code by using a series of optimizing transformations
Final Code Generation Phase
It translates the abstract intermediate code into specific machine instructions

Example:  Position := initial + rate*60
To Top