Hello,

I'm writing my first grammar and have started with something painfully
simple but yet cannot figure out why I am receiving errors.   At this point
I expect my grammar to recognize a whitespace delimited list of integers.
Any help is appreciated.

==== GRAMMAR ===
grammar Herman;

options {
  language = Java;
  //output = AST;
}

@header {
  package com.kenklose.herman;
}

@lexer::header {
  package com.kenklose.herman;
}

detail: ( integer );

integer: ( DIGIT )+;

fragment DIGIT: '0'..'9';
fragment LETTER : ('a'..'z' | 'A'..'Z');

WS: (' ' | '\t' | '\n' | '\r' | '\f') {$channel = HIDDEN;};
=== Test Bed ===
CharStream charStream = new ANTLRStringStream("1 2 3 4");
HermanLexer lexer = new HermanLexer(charStream);
TokenStream tokenStream = new CommonTokenStream(lexer);
HermanParser parser = new HermanParser(tokenStream );
parser.detail();
System.out.println("Done.");
=== Error Output ===
line 1:0 mismatched character '1' expecting set null
line 1:2 mismatched character '2' expecting set null
line 1:4 mismatched character '3' expecting set null
line 1:6 mismatched character '4' expecting set null
line 0:-1 required (...)+ loop did not match anything at input '<EOF>'
Done.
===

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to