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

Earley Parser handles epsilon productions incorrectly #169

Open
rasc00001 opened this issue Nov 30, 2023 · 0 comments
Open

Earley Parser handles epsilon productions incorrectly #169

rasc00001 opened this issue Nov 30, 2023 · 0 comments

Comments

@rasc00001
Copy link

When parsing strings that contain the result of epsilon productions with EarleyParser,
the parsed subtree containing the nullable nonterminal has an empty children list,
as if the nonterminal was a terminal.
(see description of Derivation Trees at https://www.fuzzingbook.org/html/GrammarFuzzer.html#Derivation-Trees)

To Reproduce
Steps to reproduce the behavior:
Run

from fuzzingbook.Parser import EarleyParser
next(EarleyParser({"<start>": [""]}).parse(""))

The return value is

('<start>', [])

Expected behavior
The return value is expected to be

('<start>', [('', [])])  

Additional context
This issue might cause #153

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