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

Due: Tuesday, February 16 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 after 11 pm on Wednesday, Feb. 17, even if you have more late days remaining. That will allow us to hand out a sample solution and discuss these problems as needed in sections on Thur., Feb. 18 in preparation for the midterm exam the next day.

  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