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
| Production | Semantic 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:

Fig: Parse tree
Labels: CD Unit-3, Compiler Design
Discussion & Queries (<$I18NNumComments$>):
<$CommentPager$>
- <$I18NAtCommentTimeWithPermalink$>, <$I18NCommentAuthorSaid$>
<$CommentPager$>
<$BlogCommentBody$>
<$BlogCommentDeleteIcon$>