[antlr-interest] AST rewrite infinite loop

Kirby Bohling kirby.bohling at gmail.com
Wed Oct 14 11:41:29 PDT 2009


I'm not sure what is going on there.  I'd start by removing the
NAME["foo"] from that rule and see what happens.

You might also try including a simplified version of sentence that
continues to have that problem.  In my experience, the process of
minimizing the test case to submit to the list identifies the problem.

Thanks,
   Kirby


On Wed, Oct 14, 2009 at 10:20 AM, Bill Andersen
<andersen at ontologyworks.com> wrote:
> 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
>
>
>
>
>
> 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