[antlr-interest] Reserved words
rkevinburton at charter.net
rkevinburton at charter.net
Fri Jul 11 23:52:40 PDT 2008
I am trying to build a simple script language that mimics C#. As such there are dome identifiers that are reserved. For example 'int a;' is legal but 'int int' or 'int bool' doesnt make much sense. As such I would like to make a list of some reserved words. My fiirst attempt failed miserably.
RESERVED : 'class' | 'struct' | 'int' | 'bool';
When I check this grammer I get an error that 'class' is unreachable. Further on in the grammar I have:
CLASS : 'class';
class: SCOPE CLASS IDENT '{' body '}';
It seems that even before I get around to defining IDENT to be all the legal characters for an identifier minus the reserved words, I get an error even listing the reserved words. I am obviously looking at this wrong. Any ideas?
Thank you.
Kevin
More information about the antlr-interest
mailing list