[antlr-interest] rewrite rules

John Ridgway john at jacelridge.com
Mon Jan 21 11:22:58 PST 2008


Actually the following ought to work, I believe (also untested):
  unaryright
	:	(operand -> operand)
		(   seventhops -> UNARYRIGHT seventhops $unaryright )?


Peace
- John


On Jan 21, 2008, at 12:28 PM, David Holroyd wrote:

> On Mon, Jan 21, 2008 at 11:19:00AM -0600, Shaun Bogan wrote:
>> unaryright
>> :  operand seventhops? -> ^(UNARYRIGHT seventhops? operand)
>> ;
>>
>> I am trying to get my grammar to only make the UNARYRIGHT node when
>> both seventhops and operand are present, because seventhops is
>> optional.
>
> Untested:
>
>
>  unaryright
> 	:	(operand -> operand)
> 		(
> 			seventhops -> UNARYRIGHT seventhops $unaryright
> 		|	           -> $unaryright
> 		)
>
> ta,
> dave
>
> -- 
> http://david.holroyd.me.uk/



More information about the antlr-interest mailing list