-
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
Unable to parse valid C program #281
Comments
renatahodovan
added a commit
that referenced
this issue
Feb 28, 2025
The updated backtracking algorithm allows previously matched quantified subexpressions to be undone iteratively until a valid continuation is found for the remaining input. Instead of failing immediately when a quantified match prevents further parsing, the parser now rolls back step by step, removing the last matched subexpression and retrying from an earlier position. Fixes #281.
akosthekiss
pushed a commit
that referenced
this issue
Feb 28, 2025
The updated backtracking algorithm allows previously matched quantified subexpressions to be undone iteratively until a valid continuation is found for the remaining input. Instead of failing immediately when a quantified match prevents further parsing, the parser now rolls back step by step, removing the last matched subexpression and retrying from an earlier position. Fixes #281.
@zitongzhoueric Thanks for the report! There was an issue in the quantifier matching of the parser tree recreation solution, which is hopefully fixed now. Please open a new issue if it still persists for you. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Trying to parse this simple C program using Grammarinator
This would trigger an assertion failure at parser.py::ParserTool::_adjust_tree_to_generator::_adjust_rule::314
AssertionError("Failed to match (\'unaryExpression\',) tree node to the related grammar rule at 1.")
Looks like this was introduced in #232
You can verify this program is parsable using the grammar at http://lab.antlr.org
The C grammar
The text was updated successfully, but these errors were encountered: