“The computer was born to solve problems that did not exist before.”

Random Posts

Monday, November 22, 2021

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}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages

SoraTemplates

Best Free and Premium Blogger Templates Provider.

Buy This Template