Consider the following fragment of an LALR(1) automaton as produced by Grammophone:
I was wondering, do you know if this approach to introducing the EOF $ lookahead/follow symbol is the standard approach for doing that, or is this an extension that Grammophone decided to introduce?
What I'm doing in my implementation is to simply give the starting production with the dot on the rightmost side (e.g. S -> A B C •) a $ starting lookahead which should then be propagated to wherever it is expected. One benefit of this approach is that there's no special casing needed for the constituents of a DFA node, that is, all constituents are a real production with a dot. In your case, the constituents of a DFA node can be a production with a dot, or a synthetic production with a dot (e.g. Start •, • Start).
Just wanted to hear your thoughts on that. Do you know which approach is more common?
Hello @mdaines,
Consider the following fragment of an LALR(1) automaton as produced by Grammophone:
I was wondering, do you know if this approach to introducing the EOF
$
lookahead/follow symbol is the standard approach for doing that, or is this an extension that Grammophone decided to introduce?What I'm doing in my implementation is to simply give the starting production with the dot on the rightmost side (e.g.
S -> A B C •
) a$
starting lookahead which should then be propagated to wherever it is expected. One benefit of this approach is that there's no special casing needed for the constituents of a DFA node, that is, all constituents are a real production with a dot. In your case, the constituents of a DFA node can be a production with a dot, or a synthetic production with a dot (e.g.Start •
,• Start
).Just wanted to hear your thoughts on that. Do you know which approach is more common?