Draw parse trees for the given expressions using the following grammar. Note that [number] is a terminal that has a numeric value.
[E] -] [E] + [T]
| [E] – [T]
| [T]
[T] -] [T] * [F]
| [T] / [F]
| [F]
[F] -] [number] | ( [E] )
What does the following grammar produce? Describe the list. How many elements will such a list have? Does anything appear after the elements or in-between the elements?
Note that [empty], [number], and [identifier] are terminals defined as follows: [empty] is an empty string, [number] is a numeric value, and [identifier] is like an identifier name in C/Java.
[constants] -] [const-decl] | [empty]
[const-decl] -] const [name] = [constant];
| [const-decl] [name] = [constant];
[constant] -] [number]
[name] -] [identifier]
Convert the following EBNF to BNF.
S -> A { bA }
A -> a [b]A
Prove that the following grammar is ambiguous.
[S] -] [A]
[A] -] [A] + [A] | [id]
[id] -] a | b | c