Recent Post

Translation, Difference b/w Syntax

Translation :
   Given an input string 𝓍, when we construct a parse Tree for 𝓍 and convert it into annotated parse Tree (o/p), this mapping from input to output is called translation.

Translation Scheme :-
   It is a context free grammar in which program pieces / fragments are embedded in RHS of the productions (called Semantic Actions)

Similar to SDD except the fact that Translation scheme also specifies explicitly. the evaluation order of semantic actions. 

Translation scheme generates an output for each string 𝓍 present in the language generated by the grammar , by executing the actions in the order in which they appear in the Depth First Traversal of PT for 𝓍.

e.g : E → +T {print ('*') }S

For making a parse Tree for a Translation scheme :-

(i) Make an extra node for semantic actions

(ii) Nodes for semantic actions do not have children

(iii) Evaluate node for SA whenever that node is seen 

No comments