4.1Consider the following grammar for postfix expressions.
E ::= E E + | E E - | id
4.2Construct the SLR(1) parsing table for the grammar in 4.1.
4.3Implement a parser (either LL(1) or SLR) for the language defined by the following CFG:
Program:
Assignment*
Assignment:
Identifier = Exp;
Exp:
Exp + Term | Exp - Term | Term
Term:
Term * Fact | Fact
Fact:
( Exp ) | - Fact | + Fact | Literal | Identifier
Identifier:
Letter [Letter | Digit]*
Letter:
a|...|z|A|...|Z|_
Literal:
0 | NonZeroDigit Digit*
NonZeroDigit:
1|...|9
Digit:
0|1|...|9