Compiler Design
105601Module 3: Semantic Analysis, Symbol Table, Run-time environment
Q1c. A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar: S \to xxW {print "1"}, S \to y {print "2"}, S \to Sz {print "3"} What is the translation of xxxxyzz using the syntax directed translation scheme described by the above rules? (i) 23131 (ii) 11233 (iii) 11231 (iv) 3321120232m
Module 3: Semantic Analysis, Symbol Table, Run-time environment
View this question on its own page →A shift reduce parser carries out the actions specified within braces immediately after reducing with the corresponding rule of grammar:
{print "1"}, {print "2"}, {print "3"}
What is the translation of using the syntax directed translation scheme described by the above rules?
(i) 23131
(ii) 11233
(iii) 11231
(iv) 33211Q1h. Synthesized attributed are calculated (i) From the values of attributes of the children of the node (ii) From the values of attributes of the parent of the node (iii) From the values of attributes of the siblings of the node (iv) None of these20232m
Module 3: Semantic Analysis, Symbol Table, Run-time environment
View this question on its own page →Synthesized attributed are calculated
(i) From the values of attributes of the children of the node
(ii) From the values of attributes of the parent of the node
(iii) From the values of attributes of the siblings of the node
(iv) None of theseQ2b. What is an activation record? Explain how they are used to access various local and global variables.20237m
Module 3: Semantic Analysis, Symbol Table, Run-time environment
View this question on its own page →What is an activation record? Explain how they are used to access various local and global variables.
Q4a. Given the Syntax-Directed Definition below with the synthesized attribute val. Draw the annotated parse tree for the expression (3+4) * (5+6) L \to E, L.val = E.val E \to T, E.val = T.val E \to E_1 + T, E.val = E_1.val + T.val T \to F, T.val = F.val T \to T_1 * F, T.val = T_1.val * F.val F \to (E), F.val = E.val F \to digit, F.val = digit.lexval20237m
Module 3: Semantic Analysis, Symbol Table, Run-time environment
View this question on its own page →Given the Syntax-Directed Definition below with the synthesized attribute val. Draw the annotated parse tree for the expression
,
,
,
,
,
,
,Q5b. Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement: a = (a * b + c) \uparrow (b + c) * b + c20237m
Module 3: Semantic Analysis, Symbol Table, Run-time environment
View this question on its own page →Explain how type checking and error reporting are performed in compiler. Draw syntax tree and DAG for the statement:
Q7a. Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.20237m
Module 3: Semantic Analysis, Symbol Table, Run-time environment
View this question on its own page →Differentiate between S-attribute SDT and L-attribute SDT with suitable examples.