Consider the following context-free grammar. G G B G N B (

Question:

Consider the following context-free grammar.

G → G B
    → G N
    → ∈
B → ( E )
E → E ( E )
    → ∈
N → ( L ]
L → L E
    → L (
    → ∈
(a) Describe, in English, the language generated by this grammar. (Your description should be a high-level characterization of the language—one that is independent of the particular grammar chosen.)

(b) Give a parse tree for the string (( ]( ).

(c) Give a canonical (right-most) derivation of this same string.

(d) What is FIRST(E) in our grammar? What is FOLLOW(E)? (Recall that FIRST and FOLLOW sets are defined for symbols in an arbitrary CFG, regardless of parsing algorithm.)

(e) Given its use of left recursion, our grammar is clearly not LL(1). Does this language have an LL(1) grammar? Explain.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: