Syntax Directed Translation
• Typically for grammars we are given some parsers
• In practice of compiler design we associate some informal notations
i.e.
Why use semantic rules?
• Syntax analysis
• Code generation
• Storing some values in symbol table
• Intermediate code generation
• Expression evaluation
• Can be done in parallel
At the time when parsing is being done
• Parsers are cable of doing more when we give along with grammars
some other semantic actions
• Lets see an example to evaluate an expression
Lets Evaluate 2 + 3 * 4
Now parse it
Top-Down Left-To-Right
Translation of assignment
Syntax directed-translation

Syntax directed-translation

  • 1.
    Syntax Directed Translation •Typically for grammars we are given some parsers • In practice of compiler design we associate some informal notations i.e.
  • 2.
    Why use semanticrules? • Syntax analysis • Code generation • Storing some values in symbol table • Intermediate code generation • Expression evaluation • Can be done in parallel At the time when parsing is being done
  • 3.
    • Parsers arecable of doing more when we give along with grammars some other semantic actions • Lets see an example to evaluate an expression
  • 4.
    Lets Evaluate 2+ 3 * 4 Now parse it Top-Down Left-To-Right
  • 6.