Question 21
E → number E.val = number. val | E \'+\' E E(1).val = E(2).val + E(3).val | E \'×\' E E(1).val = E(2).val × E(3).valThe above grammar and the semantic rules are fed to a yacc tool (which is an LALR (1) parser generator) for parsing and evaluating arithmetic expressions. Which one of the following is true about the action of yacc for the given grammar?
Question 22
E → number E.val = number. val | E \'+\' E E(1).val = E(2).val + E(3).val | E \'×\' E E(1).val = E(2).val × E(3).valAssume the conflicts in Part (a) of this question are resolved and an LALR(1) parser is generated for parsing arithmetic expressions as per the given grammar. Consider an expression 3 × 2 + 1. What precedence and associativity properties does the generated parser realize?
Question 23
1. P → Q R 2. P → Q s R 3. P → ε 4. P → Q t R r
Question 24
E → E1 # T { E.value = E1.value * T.value } | T{ E.value = T.value } T → T1 & F { T.value = T1.value + F.value } | F{ T.value = F.value } F → num { F.value = num.value }Compute E.value for the root of the parse tree for the expression: 2 # 3 & 5 # 6 & 4.
Question 25
Question 26
Question 27
Question 28
S → i E t S S\' | a S\' → e S | ε E → bIn the predictive parse table. M, of this grammar, the entries M[S\', e] and M[S\', $] respectively are
Question 30
S → T R R → + T {print (\'+\');} R | ε T → num {print (num.val);}Here num is a token that represents an integer and num.val represents the corresponding integer value. For an input string \'9 + 5 + 2\', this translation scheme will print
There are 85 questions to complete.