CSE P 501 Sp14 Homework 4 - LL Grammars (continued)

Due: Monday, April 28 at 11 pm. Please use the dropbox to submit your homework online. Please submit your work as some combination of PDF, plaintext, and PNG files. Please do not submit doc/docx files. You may submit a scanned copy of handwritten work, as long as it is legible and in one of the formats mentioned above. 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. This is problem 2 from homework 3, which has been postponed

    Write a grammar that accepts the language of straight-line code - no IFs or LOOPs - 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