[antlr-interest] rewrite rules

David Holroyd dave at badgers-in-foil.co.uk
Mon Jan 21 09:28:19 PST 2008


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