[antlr-interest] how to allow keywords as variables

mzukowski at yci.com mzukowski at yci.com
Thu Jun 5 15:57:41 PDT 2003


2.7.2 still does not hoist, with the exception of hoisting from lexer rules
into the nextToken() method.

Ter's method would look like

id_or_keyword:
	ID
	|"if"
	|"else"
	;

But this still can be cumbersome and generate lots of ambiguities which you
might need to straighten out with syntactic predicates.

Monty

-----Original Message-----
From: Ruslan Zasukhin [mailto:sunshine at public.kherson.ua] 
Sent: Thursday, June 05, 2003 3:22 PM
To: antlr-interest at yahoogroups.com
Subject: Re: [antlr-interest] how to allow keywords as variables


on 6/5/03 23:51, mzukowski at yci.com at mzukowski at yci.com wrote:

> For which see http://www.codetransform.com/filterexample.html.  I 
> believe there is a FAQ entry on this subject too 
> http://www.jguru.com/faq/view.jsp?EID=140

Hi Monty,

I wonder if this paragraph still true for 2.7.2 ANTLR

> Antlr, unlike PCCTS 1.3x, does not "hoist" syntactic or semantic 
> predicates. That means that you can't isolate that part into a rule 
> like this:
> 
> 
> id_or_keyword:
>   ( ID 
>   | ( ~(ID) )=>{ LT(1).possibleID() }? .
>   )
>   ;
> 

I ask because that FAQ is 4 years old,
and in Terr's mp3 was words about rule "id_or_keyword"

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list