[Points 20] Do exercise 2.7 (page 47) in the Tucker and Noonan book.
Define a grammar which generates all strings of the form anbn+kak for n, k natural numbers. For instance, lambda, ab, ba, abba, aabb, aabbba, abbbaa, etc.
Notation: xm stands for the string obtained by repeating x m times.
[Points 25] Consider the following grammar for "boolean expressions":
BExp ::= false | true | BExp and BExp | BExp imp BExp | not BExp
[Points 30] The following grammar is motivated by declarations in C:
Non-terminals: Declaration, Type, Declarator
Terminals: int, char, *, number, name, '[', ']', '(', ')'
Declaration ::= Type Declarator
Type ::= int | char
Declarator ::= * Declarator
| Declarator '[' number ']'
| Declarator '(' Type ')'
| '(' Declarator ')'
| name
Here, the start symbol is Declaration.
Declarator ::= Declarator *Why is the resulting grammar unambiguous?