[antlr-interest] Bug: String constant is too big in Parser generated by ANTLR v4

Terence Parr parrt at cs.usfca.edu
Thu Jan 12 10:28:47 PST 2012


 would have made a separate file,But it's just one more thing that can go wrong. Somebody could forget to include it, because it's not a .class file, and you might hook up the wrong file or the wrong version. Better to keep it all in the same file encapsulated. I guess I will simply have to break into multiple streams, which is easy enough. gzip'ing reduces it to about 25% of its original size, which can help your file size in the editor issue.
Ter
On Jan 12, 2012, at 5:34 AM, Christian wrote:

> It's a combined grammar of the complete Spec C# v4. The parser's string
> constant extends to 2000 LOC, the lexer's to 1000 LOC. Moreover, it
> would be great if you could extract the constant into another class so
> that loading and displaying the parser file with an editor (e.g.
> Eclipse) does not take so long.
> 
> Am 12.01.2012 02:31, schrieb Terence Parr:
>> thanks…wondering if this would come up.  Wow. big grammar?
>> Ter
>> On Jan 11, 2012, at 5:22 PM, Christian wrote:
>> 
>>> Hi everybody and especially Terence!
>>> 
>>> I get the following error message from Eclipse after ANTLR v4 has
>>> generated the parser in Java:
>>> 
>>>   The type generates a string that requires more than 65535 bytes to
>>> encode in Utf8 format in the constant pool.
>>> 
>>> I think this is due to your _serializedATN string. Could you dynamically
>>> build it with a StringBuilder perhaps? If you fix it, apply the same
>>> solution to the lexer please.
>>> 
>>> Regards,
>>> Christian
>>> 
>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>> 
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list