Header Ads Widget

Syntax directed translation scheme

Syntax directed translation scheme

  • The Syntax directed translation scheme is a context -free grammar.
  • The syntax directed translation scheme is used to evaluate the order of semantic rules.
  • In translation scheme, the semantic rules are embedded within the right side of the productions.
  • The position at which an action is to be executed is shown by enclosed between braces. It is written within the right side of the production.

Example

ProductionSemantic Rules
S → E ${ printE.VAL }
E → E + E{E.VAL := E.VAL + E.VAL }
E → E * E{E.VAL := E.VAL * E.VAL }
E → (E){E.VAL := E.VAL }
E → I{E.VAL := I.VAL }
I → I digit{I.VAL := 10 * I.VAL + LEXVAL }
I → digit{ I.VAL:= LEXVAL}

Post a Comment

0 Comments