[antlr-interest] ANTLR3 with -Xmultithreaded problem?

文少华 shaohua.wen at gmail.com
Wed Aug 15 20:14:08 PDT 2007


Dear gurus,
  I just created a grammar for TNSDL language, and it has a grammar like:

 range://p84
    closedRange -> ^(Range closedRange)
    |openRange  -> ^(Range openRange)
;

closedRange://p84
    e1=expression ':' e2=expression
    -> ^(ClosedRange $e1 $e2)
;

openRange://p84
    relationSymbol? expression
    -> ^(OpenRange  relationSymbol? expression)
;

 expression:
 .....
;

 When I tried to generate code with antlr 3.0.1(3.0 also tried), the
generated code will not compile with errors like:
  [javac] Compiling 15 source files to bin
    [javac] TNSDLParser.java:69328: code too large for try statement
    [javac]         catch (RecognitionException re) {
    [javac]         ^
    [javac]TNSDLParser.java:38965: code too large for try statement
    [javac]         try {
    [javac]             ^
    [javac] TNSDLParser.java:38952: code too large
    [javac]     public final range_return range() throws
RecognitionException {
    [javac]                               ^

After I looked into the range() method,I found that it has about 30000
lines.

But if I generage java code using antlr with -Xmultithreaded parameter with
jdk 1.6 in linux (redhat ES4, SOME Times the generated code for range()
method is only about 300 lines,and the compiler
can happily compile the generated code.

This is really strange, I don't know if it's a bug of  ANTLR, Can any one
help to analyze it?

The grammar file has been attached to the mail.

Any suggestions on correct my grammar will be highly appreciated also!

Best Regards,
Holy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070816/dc422e76/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TNSDL.g3
Type: application/octet-stream
Size: 26860 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20070816/dc422e76/attachment-0001.obj 


More information about the antlr-interest mailing list