Compiler-Design-Grammars

Question 1

Construct the LL(1) table for the following grammar.

 1. Expr → _Expr
 2. Expr → (Expr)
 3. Expr → Var Expr Tail
 4. ExprTail → _Expr
 5. ExprTail → λ
 6. Var → Id Var Tail
 7. VarTail → (Expr)
 8. VarTail → λ
 9. Goal → Expr$ 
A
Theory Explanation.
Question 2

Consider the CFG with {S,A,B} as the non-terminal alphabet, {a,b} as the terminal alphabet, S as the start symbol and the following set of production rules:

S → aB        S → bA
B → b         A → a
B → bS        A → aS
B → aBB       A → bAA

For the correct answer strings to Q.78, how many derivation trees are there?

A
1
B
2
C
3
D
4
Question 2 Explanation: 
There exist two parse tree for the string “aabbab” using LMD (left most derivation)
There are 2 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access