[antlr-interest] AST rewrite infinite loop

Bill Andersen andersen at ontologyworks.com
Wed Oct 14 08:20:59 PDT 2009


Hi folks

I have this production

assertion
	: sentence -> ^(ASSERTION NAME["foo"] sentence)
	;

in a tree grammar with rewrite = true.  This is meant to tack a name  
onto the results of parsing a 'sentence'.  Thing is when I parse a  
sample input I get an infinite tree that looks like this

(ASSERTION foo
	(ASSERTION foo
		(ASSERTION foo
			(ASSERTION foo
				(ASSERTION foo
					....

Thing is that the sentence production does not call assertion,  
otherwise I could understand why my rewrite might get itself reparsed  
or something.

Any idea what's happening here and how to stop it?

	.bill

Bill Andersen
Ontology Works, Inc. (www.ontologyworks.com)
3600 O'Donnell Street, Suite 600
Baltimore, MD 21224
Office: +1.410.675.1201
Cell: +1.443.858.6444
Fax: +1.410.675.1204






More information about the antlr-interest mailing list