[antlr-interest] unexpected char error
Kevin J. Cummings
cummings at kjchome.homeip.net
Sat Mar 17 21:26:12 PDT 2007
Hi Folks,
I wrote a PL/I compiler front end in PCCTS 1.33 10 years ago. Now, I'm
returning to the fold, and I'll be using antlr-2.7.7. So, I'm writing
some small test programs, and I have a couple of questions:
options { language = cpp; }
1) Why does this work (code snippets only):
EQ : '=' ;
UINT : ( '0'..'9' )+ ;
stmt : "a" EQ UINT ;
while this gives me errors when I run it:
UINT : ( '0'..'9' )+ ;
stmt : "a" "=" UINT ;
see the errors below:
> ./mytest a = 5
> > goal; LA(1)== > lexer mIDENT; c==99
> < lexer mIDENT; c==32
> a
> > stmt; LA(1)==a
> > lexer mWHITESPACE; c==32
> < lexer mWHITESPACE; c==61
> Parse exception: <arguments>:1:8: unexpected char: '='
2) The tree generated by:
stmt : "a" "=" UINT
is #(a)
while
stmnt : "a"^ "=" UINT
generates #(a, =, UINT)
I don't remember having to specify my root node on every rule in PCCTS
1.33, why is it necessary in antlr 2.7.7
Or am I missing something?
THANKS!
--
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)
More information about the antlr-interest
mailing list