Question: 2 LL ( 1 ) Grammar ` ` ` :: = BEG : END EOF :: = f | g :: = ( ) ::
LL Grammar
:: BEG :
END EOF
:: f g
::
::epsilon
::
::t
text morestmts ::
::
::
:: if :
t else :
text returnstmt :: return
expr :: term term
term :: variable mid digit
variable ::mathbfamathbfbmathbfc
digit :: mathbfmathbfmathbf
backslash mathbfn represents the "new line" terminal. backslash mathbft represents the "tab" terminal.
a Write an example program that can be derived from this grammar.
b Show that the grammar above is LL Use a formal argument based on the definition of the LL grammar.
c Show the LL parse table.
d Write a recursive descent parser in pseudocode. You may assume that the nexttoken function is already implemented for reading the next token in the remaining input string, and you can directly use it in your pseudocode.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
