Here's a snippet from a grammar I'm working on that's just failing in the
most bizarre ways.

grammar junk;

tokens {
    INTERFACE = 'INTERFACE';
    IDENT = 'IDENT';
    END = 'END';
}

interface
    :   INTERFACE IDENT import* declaration* END '.'
    ;

import : ;

When I run antlr on it I get the following output:

error(100): junk.g:10:9: syntax error: antlr: junk.g:10:9: unexpected token:
INTERFACE
error(100): junk.g:10:19: syntax error: antlr: junk.g:10:19: unexpected
token: IDENT
error(100): junk.g:10:50: syntax error: antlr: junk.g:10:50: unexpected
token: '.'
error(100): junk.g:13:1: syntax error: antlr: junk.g:13:1: unexpected token:
import
error(150):  grammar file junk.g has no rules
error(100): junk.g:0:0: syntax error: assign.types: <AST>:0:0: unexpected
end of subtree
error(100): junk.g:0:0: syntax error: define: <AST>:0:0: unexpected end of
subtree
error(10):  internal error: junk.g : java.lang.NullPointerException
org.antlr.grammar.v2.DefineGrammarItemsWalker.trimGrammar(DefineGrammarItemsWalker.java:94)
org.antlr.grammar.v2.DefineGrammarItemsWalker.finish(DefineGrammarItemsWalker.java:77)
org.antlr.grammar.v2.DefineGrammarItemsWalker.grammar(DefineGrammarItemsWalker.java:206)
org.antlr.tool.Grammar.defineGrammarSymbols(Grammar.java:702)
org.antlr.tool.CompositeGrammar.defineGrammarSymbols(CompositeGrammar.java:351)
org.antlr.Tool.process(Tool.java:451)
org.antlr.Tool.main(Tool.java:91)

I have tried renaming the INTERFACE token, the IDENT token, the interface
production, etc. in various combinations and none of it works.  What
incredibly obvious thing am I overlooking?

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.


Reply via email to