Consider the following BNF grammar that we saw in class:
EXP ::= EXP
+ TERM | EXP - TERM | TERM
TERM ::= TERM *
FACTOR | TERM / FACTOR | FACTOR
FACTOR ::= ( EXP ) |
DIGIT
DIGIT ::= 0 | 1 | 2 | 3
(a) Translate into EBNF.
(b) Draw syntax diagrams.
(c) What are the two requirements on a grammar for a
predictive parser to be able to make right choice?
(d) Compute First and Follow sets for each of the
non-terminals
(e) Prove that the grammar satisfy the two
requirements defined in (c).




Consider the following BNF grammar that we saw in class: EXP ::= EXP + TERM ...
please provide good explanation.
Consider the following grammar for variable and class
declarations in Java:
<Decl> -> <VarDecl>
| <ClassDecl>
<VarDecl> -> <Modifiers> <Type> <VarDec> SEM
<ClassDecl> -> <Modifiers> CLASS ID LBRACE <DeclList> RBRACE
<DeclList> -> <Decl>
| <DeclList> <Decl>
<VarDec> -> ID
| ID ASSIGN <Exp>
| <VarDec> COMMA ID
| <VarDec> COMMA ID ASSIGN <Exp>
Indicate any problems in this grammar that prevent it from being
parsed by a recursive-descent parser with one token lookahead. You
can simply...