代写 CS314 Fall 2018 Assignment 3

CS314 Fall 2018 Assignment 3
1 LL(1) Grammar and Recursive Descent Pars- ing ::= def : \n EOF ::= f | g
::= ( )
::= , | ¦Å
::=
::= \t
::= \n | ¦Å
::= | |
::= =
::= <=
::= if : \n \t else : ::= return
::= +
::= |
:: =a|b|c
:: =0|1|2
\n represents the ¡°new line¡± terminal. \t represents the ¡°tab¡± terminal. (a) Show that the grammar above is LL(1). Use a formal argument based
on the definition of the LL(1) grammar. (b) Show the LL(1) parse table.
1

(c) Write a recursive descent parser for the above grammar in pseudo code in the same format as that in lecture 6.
2