-
Notifications
You must be signed in to change notification settings - Fork 62
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
Wrong python code generated #66
Comments
Hi @bendrissou Thanks for the report! The generated Python code is incorrect, since the input grammar is not correct either. Grammarinator follows the syntax of ANTLR where terminal rules must not refer to non-terminals. If you generate a parser from the grammar above with ANTLR then you get the following error message:
If you transform You are right though, that it would be helpful to throw an error from grammarinator-process if the input grammar is not correct. I'll think about it how to handle all the possible input errors (w/o explicitly validating it with ANTLR). |
@bendrissou Did you manage to fix the grammar? Can we close this issue? |
Yes, I have fixed my grammar. I only wanted to report the bug. Found the bug with my fuzzer. |
Grammarinator generating incorrect code with some grammars. In particular, when a non-terminal is in the definition of a token. When generating the code with
grammarinator-process
, no error is thrown. Only when generating inputs withgrammarinator-generate
,does the error appear.The bug can be reproduced with the following grammar:
After running
grammarinator-process
andgrammarinator-generate
. The error message thrown is:When looking at the file
JSONUnlexer.py
, we see the following invalid code:The text was updated successfully, but these errors were encountered: