[antlr-interest] Recursive Grammar

Terence Parr parrt at jguru.com
Thu Jun 6 15:31:13 PDT 2002

On Thursday, June 6, 2002, at 03:09  PM, johnclarke72 wrote:

> If I have a situation when an item specified in a grammar can be
> repeated within itself how can I describe that using Antlr ?  eg A
> HTML Comment within a comment eg
> <!-- <!-- A HTML Comment --> -->
> I would be grateful for all advice offered.

Comment is a hard one due to the terminating condition needing 3 symbols 
of lookahead, but normally you would just do this:

rule : STUFF rule END_STUFF
        | OTHER_STUFF

recursion ain't no trouble...though in this case you might have trouble 
with the "rule" terminating condition.

Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list