-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
I was working on my parser and wanted to validate my outputs but i may ended up finding a bug here, or.... my theory is just bad.
Grammar:
S: A B C;
A: a A | /*eps*/ ;
B: b B | C d| /*eps*/ ;
C: c C | A e | /*eps*/ ;
D: S f | A D | g;
FIRST sets:
S = { a, b, c, d, e, ε }
A = { a, ε }
B = { a, b, c, d, e, ε }
C = { a, c, e, ε }
D = { a, b, c, d, e, f, g }
FOLLOW sets:
S = { $, f }
A = { a, b, c, d, e, f, g, $ }
B = { a, c, e, $, f }
C = { d, $, f }
D = {}
Wrong LL Parsing Table:
a b c d e f g $
S 1 1 1 1 1 - - -
S derives ε from First(ABC) so next it should be calculating Follow(S) ∈ {f, $}
Correct LL Parsing Table:
a b c d e f g $
S 1 1 1 1 1 1 - 1
Metadata
Metadata
Assignees
Labels
No labels