[antlr-interest] newbie question - mismatched input/token

Ashish asengine at gmail.com
Thu Jan 17 15:15:22 PST 2008


Hi,
I'm trying to come up with a custom select statement. However, for the
simple grammar and input I get a mismatched-token error - see details below.
Obviously I'm missing something basic here. Thanks in advance

-Ashish

//Input
SELECT a FROM b

//Error message:
recoverFromMismatchedToken
BR.recoverFromMismatchedToken
line 1:0 mismatched input 'SELECT' expecting FROM
//Select.g:
grammar Select;

prog : sstmt;

sstmt : select (from)?;

select : SELECT ID+ ;

from  : FROM ID+   ;

SELECT : 'select'|'SELECT';
FROM : 'from'|'FROM';
WHERE : 'where'|'WHERE';
ID :  ('a'..'z'|'A'..'Z')+;
INT :  ('0'..'9')+;
WS : (' '|'\t')+ {$channel=HIDDEN;};
NEWLINE : ('\r'|'\n')+ {$channel=HIDDEN;};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080117/abe92896/attachment.html 


More information about the antlr-interest mailing list