Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(25pt) Consider the following grammar, G, for conditional statements: 1. PS$ 6. U if C then S 2. SB 7. U if C then B

image text in transcribed

(25pt) Consider the following grammar, G, for conditional statements: 1. PS$ 6. U if C then S 2. SB 7. U if C then B else U 3. SU 8. Cci,i1 4. B if C then B else B9. Osi,i1 5. BO Nonterminals: P,S,B,U,C,O; terminals: if, then, else, ci,si,$ (a) (2pt) Show the parse tree of G for the input: if c1 then if c2 then s1 else if c3 then s2$. (b) (3pt) Compute First(X),FOLlow(X), for all nonterminals X, and PrediCt(p), for all productions p,1p9. (c) (5pt) Prove that G is not LL(1). Indicate all conflicts, that is, tokens belonging to two PREDICT(p) sets with the same LHS. (d) (10pt) Employ, on G, the techniques we used for attempting to make a grammar LL(1). Try to address all conflicts discovered at (c). (e) (5pt) Explain why it does not seem possible to obtain an LL(1) grammar

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions