On Mon, Oct 10, 2005 at 10:45:54AM -0400, Matt Fowles wrote:
> Perhaps a better approach would be to perform a bit
> of static analysis on the grammar and look for left recursions at
> creation time (I believe that is a known problem).  Then we can just
> warn once up front and go on our merry way recursing at matchtime.

I think this approach falls back into my category of 
"unless someone wants to take on the task of implementation it's not
likely to be resolved anytime soon..."  :-) :-)

In a dynamic environment like the one we have (parrot/perl) I find it's
really hard to say what constitutes "creation time", especially since
we can refer to subrules dynamically ( <$foo>, <::$foo>, etc. ) and
our grammars have inheritance in which a rule defined by a parent
grammar can invoke a rule defined later in a child grammar.  As with 
closures, we could probably punt on performing any analysis of
rules with dynamic references or that refer to rules outside of
the current grammar.  But given that we can't really know until
matchtime what subrule will be invoked by an expression like <binary>, 
it's hard for me to imagine a whole lot we can do in the way of
static analysis beforehand.  However, that could easily just be a 
limit of my imagination.  

Pm

Reply via email to