1. Derive “23 + (1 – (7 * 2))” using the following grammar with start symbol < Expression >.You
may apply multiple productions in the same step (in di erent parts of the expression), but you
may not skip steps. Then draw a parse tree.

-> 0|1|2|3|4|5|6|7|8|9

->

->

->

-> ()

-> +

-> –

-> *

-> /

2. Derive the language of the following grammar with start symbol S. You need to derive
3 rounds.
S -> AB
A -> ab | aAb
B -> c | cB
3. Construct a parse table for the following grammar with start symbol A. Using your
parse table, parse the input “abcababc”.
1:A -> BB
2:B -> abC
3:C -> B
4:C -> c
4. Find a grammar describing the following regular expression: (a | b)* |ac



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *