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

UnsupportedOperationException while generating code for large grammars. #2732

Closed
mimuogi opened this issue Jan 22, 2020 · 4 comments
Closed

Comments

@mimuogi
Copy link

mimuogi commented Jan 22, 2020

When generating code for large grammars we are getting this exception log. The code generation targets C#.

Exception in thread "main" java.lang.UnsupportedOperationException: Serialized ATN data element 85257 element 11 out of range 0..65535
at org.antlr.v4.runtime.atn.ATNSerializer.serialize(ATNSerializer.java:362)
at org.antlr.v4.runtime.atn.ATNSerializer.getSerialized(ATNSerializer.java:601)
at org.antlr.v4.Tool.generateInterpreterData(Tool.java:745)
at org.antlr.v4.Tool.processNonCombinedGrammar(Tool.java:400)
at org.antlr.v4.Tool.process(Tool.java:361)
at org.antlr.v4.Tool.processGrammarsOnCommandLine(Tool.java:328)
at org.antlr.v4.Tool.main(Tool.java:172)

UserGrammar.g4

@KvanTTT
Copy link
Member

KvanTTT commented Jan 22, 2020

What runtime have you tried? Official (this) or optimized by @sharwell?

Also, could you attach your grammar where such an exception occurs?

@mimuogi
Copy link
Author

mimuogi commented Jan 24, 2020

What runtime have you tried? Official (this) or optimized by @sharwell?
Also, could you attach your grammar where such an exception occurs?

I tried the official runtime. For privacy reasons I can't share the grammar at the issue and I had contact you through your email. Thank you for your help.

@JenniferPruitt
Copy link

I noticed that there is a similar problem at #840. Perhaps we can refer to this issue to find more context about the bug.

KvanTTT added a commit to KvanTTT/antlr4 that referenced this issue Jan 15, 2022
Refactor ATN serializer and deserializer, use ATNDataWriter, ATNDataReader

Remove excess data cloning in deserializer

fixes antlr#1863, fixes antlr#2732, fixes antlr#3338
KvanTTT added a commit to KvanTTT/antlr4 that referenced this issue Jan 16, 2022
Refactor ATN serializer and deserializer, use ATNDataWriter, ATNDataReader

Remove excess data cloning in deserializer

fixes antlr#1863, fixes antlr#2732, fixes antlr#3338
KvanTTT added a commit to KvanTTT/antlr4 that referenced this issue Jan 17, 2022
Refactor ATN serializer and deserializer, use ATNDataWriter, ATNDataReader

Remove excess data cloning in deserializer

fixes antlr#1863, fixes antlr#2732, fixes antlr#3338
KvanTTT added a commit to KvanTTT/antlr4 that referenced this issue Feb 20, 2022
@parrt parrt added this to the 4.10 milestone Mar 26, 2022
@parrt
Copy link
Member

parrt commented Mar 26, 2022

Fixed by #3591

@parrt parrt closed this as completed Mar 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants