-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Generating bad sempred method #27
Comments
The example grammar contains an LR rule ( The tool should either generate working code or produce an error message and fail to generate code. |
is it possible to fix this issue in the near future? It is a real blocker for my current project (yes, I know, I should not depend on an ea version ;). @sharwell: Ter stated that only mutually left recursive rules are forbidden. The example is not mutually left recursive, so it should compile fine. |
ha! I just figured this out!!! don't use rule as a rule name because it becomes RuleContext which is the predefined context object. |
great, the sempred is gone. I guess you should disallow rules with that name. However, the generated parser still does not work, see the new issue: #45 |
I created #77 to address the naming problems. |
The resulting grammar is accepted by latest Honey Badger (the one pulled from parrt/antlr). However, the resulting parser contains errors: an unused
sempred
method with errors is produced. Since it is unused, I simply deleted it. However, the parser still does not match the input correctly. I guess both things have are symptoms of the same bug.Here is (a simplified version of) the grammar producing the erroneous parser:
the resulting unused
sempred
with errors:The problems are the casts
(StrongExprContext)_localctx
and(ExprContext)_localctx
, since_localctx
is aRuleContext
here. As mentioned, thesempred
is not called anyway.The text was updated successfully, but these errors were encountered: