umut-sahin / dotlr

An LR(1) parser generator and visualizer created for educational purposes.
Apache License 2.0
91 stars 4 forks source link

Wrong first/follow? #20

Closed Specy closed 4 days ago

Specy commented 1 week ago
S->A B
A-> C
C-> D
D -> ''
B->'x'

This grammar produces follow/first table:

+--------+-----------+------------+
| Symbol | First Set | Follow Set |
+--------+-----------+------------+
| C      | { ε }     | { 'x' }    |
+--------+-----------+------------+
| D      | { ε }     | { 'x' }    |
+--------+-----------+------------+
| B      | { 'x' }   | { $ }      |
+--------+-----------+------------+
Specy commented 1 week ago

Looking at the output it seems like the Follow table is constucted correctly, but the FIRST table is missing the symbols "S,A"