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

Ignored terminal used in the grammar is expected with Earley but not with LALR #1473

Open
Molrn opened this issue Sep 26, 2024 · 0 comments
Open

Comments

@Molrn
Copy link

Molrn commented Sep 26, 2024

Describe the bug

When a terminal is ignored but still used in the grammar, the behavior is different depending on the parser used. With LALR, the terminal is ignored, with Earley it is expected.

According to the doc, the behavior of LALR seems to be the expected one, but the Earley behavior still makes sense.

To Reproduce

grammar = """
start : "CREATE" WS "START"
%import common.WS
%ignore WS
"""

lalr_parser = Lark(grammar, parser="lalr")
lalr_parser.parse("CREATE START")            # Fails
lalr_parser.parse("CREATESTART")             # Succeeds

earley_parser = Lark(grammar, parser="earley")
earley_parser.parse("CREATE START")       # Succeeds
earley_parser.parse("CREATESTART")        # Fails
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