COSC450/550 HW 3

COSC450/550 HW 3
1. Perform the pairwise disjointness test for the following grammar rules.
a. A à aB | b | cBB
b. B à aB | bA | aBb
c. C à aaA | b | caB
2. Show a trace of the recursive descent parser given in Section 4.4.1 for the string a + b * c
3. Given the following grammar and the right sentential form, draw a parse tree and show
the phrases and simple phrases, as well as the handle for bBab.
S à aAb | bBA
A à ab | aAB
B à aB | b
4. Construct LR parsing table for the following grammar:
S à Aa | dAb |dca |cb
A à c
5. Show a complete parse, including the parse stack contents, input string, and action for
the string id * ( id + id ), using the grammar and parse table in Section 4.5.3
Powered by