[antlr-interest] Doubt About rewrite rulse

Victor Giordano power_giordo at yahoo.com.ar
Tue Aug 10 12:32:35 PDT 2010


Hi, i am a newbie. Trying to figure out how to work with AST tree and 
generate it. Basically you have to use the ^ and ! operators. But the 
doubt cames with the rewrite rules:

for example (Very very simple):

// matches expresion
expr : term (('+'|'-')^ term)* ;
term : factor (('*'|'/')^ factor)*;
factor: NUMBER | '('! expr ')'!;
NUMBER : '0'..'9';

That works just fine.. (i guess)
butttttttt if i want to use rewrite rules... how do i thread the 
repetion EBNF operator like * or +.

expr : term (('+'|'-') term)* -> term ^(('+'|'-') term)* ;

term : factor (('*'|'/') factor)* -> factor ^(('*'|'/') factor)*;

factor	: NUMBER /*-> NUMBER*/
	| '(' expr ')'/* -> expr*/;
	
NUMBER : '0'..'9';

But i just don't work!!.

Well i hope you undestand the question!! And i hope, over all things, 
that someone knows the answer jejeje!.
Thanks for advance.
Victor!.





El 10/08/2010 02:18 p.m., Jim Idle escribió:
> It is a bug with configure and it seems to be innocuous. I have made some
> half-hearted attempts to get rid of it, and will try to lose it in the next
> release. It is probably that one of the former 'standard' macros has been
> superseded.
>
> Jim
>
>
>> -----Original Message-----
>> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
>> bounces at antlr.org] On Behalf Of Alan Lehotsky
>> Sent: Tuesday, August 10, 2010 6:45 AM
>> To: antlr-interest at antlr.org
>> Subject: [antlr-interest] problems with libantlr 3.2 release configure
> script
>>
>> The distributed configure script produces a warning message (on pretty
>> much every linux, solaris, hp, and ibm unix-like system I've built it
> on...)
>>
>>            ./configure[19707]: #include: not found
>>
>> When I track this down, I see that line 19707 of configure is
>>
>>            $ac_includes_default
>>
>> As a shell command, which expands into essentially a long sequence of cpp
>> #ifdef's and #includes.
>>
>> I suspected a corrupted configure, so I tried rebuilding with
> autoconf-2.60.  A
>> pristine configure shows that same problem.
>>
>> Unfortunately, I'm now in over-my-head for autoconf and aclocal debugging.
>> Anyone else seeing this or have insights into whether this is anything
> worth
>> worrying about?
>>
>>
>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
>> email-address
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



More information about the antlr-interest mailing list