[antlr-interest] ANTLR first time user getting error
Dibyendu Majumdar
mobile at majumdar.org.uk
Sat Sep 11 16:51:35 PDT 2010
Hi,
I am trying to use ANTLR for the first time, and am getting an error when
trying to run the grammar shown below; I would be grateful for any help in
identifying what the issue is.
The test input I am using is:
package test;
I am using the Eclipse ANTLR IDE plugin and when I try to interpret above, I
get:
MimatchedTokenException: Line 1:7 mismatched input '' expecting '\u0006'
Below is the grammar I am using:
----------------------------------
grammar Problematic;
options {
language = Java;
}
compilationUnit
: packageDeclaration
;
packageDeclaration
: PACKAGE qualifiedName SEMI
;
qualifiedName
: IDENTIFIER (DOT IDENTIFIER)*
;
WS
: (
' '
| '\r'
| '\t'
| '\u000C'
| '\n'
)
{
skip();
}
;
PACKAGE
: 'package'
;
SEMI
: ';'
;
DOT
: '.'
;
IDENTIFIER
: ('a'..'z'|'A'..'Z'|'_'|'$') ('a'..'z'|'A'..'Z'|'_'|'0'..'9'|'$')*
;
More information about the antlr-interest
mailing list