Let's build the top-down parsing table for the following grammar, with start nonterminal L.
| 1. L | → | ε |
| 2. L | → | N |
| 3. N | → | E R |
| 4. R | → | ε |
| 5. R | → | , N |
| 6. E | → | n |
The FIRST and FOLLOW sets are easy to compute, using the algorithms from the two preceding sections.
| X | L | N | R | E |
|---|---|---|---|---|
| FIRST(X) | {n, ε} | {n} | {,, ε} | {n} |
| FOLLOW(X) | {$} | {$} | {$} | {,, $} |
The parsing table is as follows.
| Table D | |||
|---|---|---|---|
| n | , | $ | |
| L | 2 | 1 | |
| N | 3 | ||
| R | 5 | 4 | |
| E | 6 | ||