Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the approach to propagating the EOF lookahead that Grammophone takes a nonstandard extension? #51

Open
modulovalue opened this issue Apr 27, 2024 · 0 comments

Comments

@modulovalue
Copy link

Hello @mdaines,

Consider the following fragment of an LALR(1) automaton as produced by Grammophone:

Screenshot 2024-04-27 at 12 01 30

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant