-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
%%
S
: A B C
;
A
: "a"
;
B
: B "b" C
| /* empty */
;
C
: "c" A
;
First set:
- Expected: FIRST(B) should be
{"b"} - Actual: FIRST(B) is
{ε}
Follow set:
- Expected: FOLLOW(B) should be
{"c"} - Actual: FOLLOW(B) is
{"b", "c"}
./bin/syntax -g ~/test.bnf -m lalr1 --sets all
First set:
┌────────┬───────────┐
│ Symbol │ First set │
├────────┼───────────┤
│ S │ "a" │
├────────┼───────────┤
│ A │ "a" │
├────────┼───────────┤
│ B │ ε │ <-- BUG
├────────┼───────────┤
│ C │ "c" │
└────────┴───────────┘
Follow set:
┌────────┬─────────────┐
│ Symbol │ Follow set │
├────────┼─────────────┤
│ S │ $ │
├────────┼─────────────┤
│ A │ "c", $, "b" │
├────────┼─────────────┤
│ C │ $, "c", "b" │
├────────┼─────────────┤
│ B │ "c", "b" │ <-- BUG
└────────┴─────────────┘
Predict set:
┌─────────────────┬─────────────┐
│ Production │ Predict set │
├─────────────────┼─────────────┤
│ 1. S -> A B C │ "a" │
├─────────────────┼─────────────┤
│ 2. A -> "a" │ "a" │
├─────────────────┼─────────────┤
│ 3. B -> B "b" C │ "b" │
├─────────────────┼─────────────┤
│ 5. C -> "c" A │ "c" │
└─────────────────┴─────────────┘
Metadata
Metadata
Assignees
Labels
No labels