1) Given the grammar G:
G: * ::= + |
::= * |
::= a | b | c
a) (5pts) Show that t
1) Given the grammar G:
G: * ::= + |
::= * |
::= a | b | c
a) (5pts) Show that the sentence a * b + c belongs to L(G) by building an appropriate parse tree.
b) (5pts) Extend the grammar G by adding rules to the grammar for the operator == that has the lowest precedence of all operators in the grammar and is left associative.
c) (10pts) Show that your extended grammar can derive the sentences a+b == b and a == b == c by constructing the appropriate parse trees.
2) (5pts) Is the following grammar Q ambiguous? Why or why not?
Q: * ::= | 0 | 1
3) Let L(G) be the set of all strings that start with the symbol [ followed by comma separated zero or more a’s followed by the symbol ].
a) (5pts) Design the grammar G.
b) (10pts) Show that your grammar can derive the following sentences:
[ ]
[a]
[a,a,a]