Exercises 04

Only one exercise this week, enjoy. Hand in your assignment at the latest on Wednesday, Oct. 15th, 8:15am (note time change: it is due before labs!). Late submissions will not be graded.

You can hand them in as you arrive to the lab session, or drop them off earlier at BC 363.

LR(0) parsing & SLR grammar

(ex. 3.11 from the Tiger book, page 84)

Construct the LR(0) states (see textbook and Automata for LR Parsing without Lookahead) for this grammar, and then determine whether it is an SLR grammar.

0: SB$

1: B → id P

2: B → id ( E ]

3: P

4: P → ( E )

5: EB

6: EB , E

Note that production 2 contains open round parenthesis and closed square bracket. The right-hand side of production 3 is the empty string.