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

Random Posts

Monday, November 22, 2021

Implementation of Syntax directed translation

Implementation of Syntax directed translation

Syntax direct translation is implemented by constructing a parse tree and performing the actions in a left to right depth first order.

SDT is implementing by parse the input and produce a parse tree as a result.

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}

Parse tree for SDT:

Implementation of Syntax directed translation

Fig: Parse tree

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages

SoraTemplates

Best Free and Premium Blogger Templates Provider.

Buy This Template