antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.15k stars 3.7k forks source link

Cobol85 grammar #1298

Closed parikhabhi007 closed 5 years ago

parikhabhi007 commented 5 years ago

Hi @uwol, @teverett, @KvanTTT, @parrt and everyone,

I am trying to build the cobol85 grammar using the ANLTR4 and then test the generated parser. I was successfully able to get the java parser (.java) files but when I tried to compile using "javac", Cobol85Parser.java threw an error stating "UTF8 representation for the string at line 12 is too long for the constant pool". I am attaching a snapshot for the same.

"Google" resources including Java documentation states that "A UTF-8 constant pool entry can be no more than 65535 bytes long." and there is no other way to avoid this error except for rectifying the buggy code.

Please help me out to tackle this problem.

antlr_cobol_error

teverett commented 5 years ago

Please take a look here. This example has been updated to use the COBOL85 grammar and it works properly.

https://github.com/teverett/antlr4example

uwol commented 5 years ago

The grammar is also used at the core of ProLeap COBOL parser and compiling it with Java SE Development Kit 8 works well, even with a lot of additional Java classes for tests etc.