Question: ( python code required ) 2 . Consider the grammar above which is an extension to what we had in class. PROGRAM - > STMTS
python code required Consider the grammar above which is an extension to what we had in class.
PROGRAM STMTS
STMTS STMT STMT ; STMTS
STMT id EXPR
EXPR EXPR TERM EXPR TERM TERM
TERM TERM FACTOR TERM FACTOR FACTOR
FACTOR EXPR id integer
WherePROGRAM STMTS STMT EXPR, TERM, FACTOR are nonterminals and ; id integer are terminals. PROGRAM is the start nonterminal, and the terminal id is defined using the regular expression: letterletter digit
a Modify the grammar to add the power operator and unary sign operators and
b Rewrite the grammar such that it can be parsed by an LLparser
c Use the written grammar as a base to implement LLparser
d Test your code with a correct and incorrect input code.
e Report Code of the parser, parsing table, testing the codes, a screenshot of the outputs or GUI if any
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
