[antlr-interest] v3.3.1 Upgrade Problems

Avid Trober avidtrober at gmail.com
Fri May 8 20:06:08 PDT 2009


I've been running antlr.3.1.jar without any problems for some time now.
I recently obtained antlr.3.1.3.jar, changed my CLASSPATH accordingly, and now all my grammars have weird warnings and/or errors.

Is there more to an ANTLR upgrade than just downloading the new jar and making sure it's in the CLASSPATH? (and, nothing else.  Netmon confirms the proper ANTLR version is running).

This is what I grabbed:  (http://www.antlr.org/download/antlr-3.1.3.jar, from http://www.antlr.org/download.html labeled "Complete ANTLR 3.1.3 jar; all tools, runtime, etc... (included in source distribution)"


An example of some errors on a trivial test grammar:


D:\ANTLRWorks\grammars\Trivial>java org.antlr.Tool  Trivial.g
error(10):  internal error:  : java.lang.Error: Error parsing Trivial.g: 'memoiz
e' not expected ';'
org.antlr.tool.GrammarSpelunker.match(GrammarSpelunker.java:74)
org.antlr.tool.GrammarSpelunker.options(GrammarSpelunker.java:126)
org.antlr.tool.GrammarSpelunker.parse(GrammarSpelunker.java:91)
org.antlr.Tool.sortGrammarFiles(Tool.java:525)
org.antlr.Tool.process(Tool.java:383)
org.antlr.Tool.main(Tool.java:91)

v3.1.3 doesn't like anything about the options section now.  If I remove the options section, the parse now hates AST rewrites or ^:


D:\ANTLRWorks\grammars\Trivial>java org.antlr.Tool  Trivial.g
error(100): Trivial.g:20:14: syntax error: antlr: Trivial.g:20:14: unexpected to
ken: ^(
error(100): Trivial.g:20:20: syntax error: antlr: Trivial.g:20:20: expecting SEM
I, found ')'


here's the Trivial grammar:

grammar Trivial;



tokens
{
 UNIT = 'UNIT';
 ITEM = 'ITEM';
 ITEM_DETAIL_LIST;
 ITEM_DETAIL = 'ITEM_DETAIL';
 TYPE = 'TYPE';
 CASE = 'CASE';
 VALUE = 'VALUE';
 IDBC = 'IDBC';
 END_UNIT = 'END_UNIT';
}


itemValueIDBC
 : 'IDBC' -> ^(IDBC) 
 ;
 
identifier 
 : IDENTIFIER;



IDENTIFIER : ('A' .. 'Z' | 'a'..'z') ( 'A' .. 'Z' | 'a'..'z' | '0' .. '9' | '_')* 
 ;

INTEGER
 : '0' .. '9' ( '0' .. '9' )*
 ;
 
WS : (' '|'\r'|'\t'|'\n') {$channel=HIDDEN;}
 ;

EOL  : ('\n' | '\r' | EOF)
 ;


---------------END OF GRAMMAR ---------------







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090508/2d4a9cad/attachment.html 


More information about the antlr-interest mailing list