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

Due: Monday, February 9 at the beginning of class. We suggest you show your work to help us award partial credit if appropriate, and for TA sanity. You should do this assignment individually.

  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