-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
Grammar sends Earley implementation to an infinite loop #3
Labels
Comments
@erezsh If I understand correctly, this grammar is not malformed, but also enters into an infinite loop: from lark import Lark
l = Lark('''
start: bar+
bar: /a|b|c*/ "foo"
''')
l.parse('afoobfooccfoo') |
It seems the issue is that the regex can match zero characters. This one works fine:
and this one fails in the same way as the example above:
|
Thanks, good catch! I think the correct response is to forbid empty regexps. |
Both issues resolved. |
erezsh
added a commit
that referenced
this issue
Mar 9, 2017
Fixed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Earley implementation never terminates when running with the input "a", and the following grammar:
Of course the grammar is badly formed, but since we aspire to parse "any grammar", an error is a more appropriate behavior.
The text was updated successfully, but these errors were encountered: