Similar questions 7 more →
Parsing & Syntax Analysis


Answer & solution
Answer: E/a→aA; E/(→(E); A/+→+E; A/*→*E; A/)→ε; A/$→ε; all other entries error. (no official key was published)
For a nonnullable right-hand side put its production under its FIRST terminals. For ε use FOLLOW(A). The complete table is:
nonterminal | a | ( | ) | + | * | $
E | E→aA | E→(E) | error | error | error | error
A | error | error | A→ε | A→+E | A→*E | A→ε
Every occupied cell has exactly one production, so this grammar is LL(1). For example, on a+a the parser selects E→aA, matches a, uses A→+E, matches +, selects E→aA, matches a, then uses A→ε at end of input. The end marker is a parser marker, not a terminal in the original alphabet.