Question: LL ( 1 ) Grammar program > :: = def funcname > arguments > : ? block > EOF funcname > :: = f |
LL Grammar
program :: def funcname arguments
block EOF
funcname ::
arguments variable morevars
morevars :: variable morevars
block :: stmtlist
stmtlist :: stmt morestmts
morestmts ::
stmtlist
stmt :: assign ifstmt returnstmt
assign :: variable expr
condition :: variable expr
ifstmt :: if condition : ::::::::::
returnstmt :: return variable
expr :: term term
term :: variable digit
variable ::
digit ::
represents the "new line" terminal. represents the "tab" terminal.
Show that the grammar above Use a formal argument based
the definition the grammar.
Show the parse table.
Write a recursive descent parser pseudocode. You may assume that
the oken function already implemented for reading the next
token the remaining input string, and you can directly use your
pseudocode.
else :
returnstmt :: return variable
expr :: term term
term :: variable digit
variable ::
digit ::
represents the "new line" terminal. represents the "tab" terminal.
Show that the grammar above Use a formal argument based
the definition the grammar.
Show the parse table.
Write a recursive descent parser pseudocode. You may assume that
the oken function already implemented for reading the next
token the remaining input string, and you can directly use your
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
