CSE 401 Au10 (Mini)Homework 3 - LL Grammars and Parsers

Due: Wed. Nov. 3 online by 11 pm (a scanned copy is fine). We suggest you show your work to help us award partial credit if appropriate, and for TA sanity. You should do this assignment individually.

No late assignments will be accepted, even if you have late days available. That will allow us to hand out a sample solution and discuss these problems as needed in sections the next day in preparation for the midterm exam on Fri. Nov. 5..

  1. Cooper & Torczon exercise 2 for section 3.3 page 730.

  2. Write a grammar that accepts the straight-line code language given below, but that is suitable for LL(1) parsing. That is, eliminate the ambiguity, eliminate the left recursion, and (if necessary) left-factor.
    	S ::= S ; S
    	S ::= id := E
    	S ::= print( L )
    	E ::= id
    	E ::= num
    	E ::= E + E
    	E ::= ( S, E )
    	L ::= E
    	L ::= L , E