[antlr-interest] Compiling the Generated Code

Marc-André Laverdière ma_laver at ciise.concordia.ca
Tue Apr 24 07:49:21 PDT 2007


Hello,

I generated the code from my grammar using ANTLRWorks 1.0b11 and I've 
imported the code in my Eclipse project. There are compiler errors that 
I don't understand.

They happen in the parser: one of my rules has {greedy=false;}, and this 
is put in the Java code, but the compiler complains that greedy doesn't 
exist. When I comment it out, it complains about a RecognitionException 
that can't be thrown, so I'd have to remove the try, catch and finally 
structure. Is it supposed to be like that?

Further, looking at that code, I don't see how it is supposed to act in 
a non-greedy manner! It is a (.)* rule, non-greedy, that should stop 
when a given token is read.

It works fine in AntlrWorks, btw (tested in 1.0b10). So, its a bit of a 
surprise here.

Thanks a ton in advance. This is my first excursion in the field of 
programming language design, and I hope it won't be a too painful one!

Regards,


-- 
Marc-André LAVERDIÈRE, B. Eng., M. A. Sc. (in progress)
Computer Security Laboratory - Laboratoire de sécurité informatique
CIISE, Université Concordia University, Montréal, Québec, Canada
www.ciise.concordia.ca

/"\
\ /    ASCII Ribbon Campaign
  X      against HTML e-mail
/ \

"Perseverance must finish its work so that you may be mature and 
complete, not lacking anything." -James 1:4


More information about the antlr-interest mailing list