Subject: Re: [PATCH] DTC: Remove the need for the GLR Parser.

From: David Gibson <[email-masked]>
Date: Wed, 24 Oct 2007 09:44:50 +1000

On Tue, Oct 23, 2007 at 11:07:39AM -0500, Jon Loeliger wrote:
> So, like, the other day Jon Loeliger mumbled:
> > 
> > > First, a trivial one: I remember leaving this as a right-recursion,
> > > despite the stack-nastiness, because that way the properties end up in
> > > the same order as in the source.  I think that behaviour is worth
> > > preserving, but of course we can do it with left-recursion by changing
> > > chain_property() to add to the end of the list instead of the
> > > beginning.
> > 
> > Understood.  And I wrestled with that as well.  In fact, I even
> > wrote the reverse_properties() function, which I will include,
> > and used it initially.  However, several test failed.  So I
> > removed it, and it all started happily working again.
> 
> I was confused.  It was the version of the code that _did_
> use the property reversal that worked.

Ok.  Except that I think we shouldn't need to have an explicit
reverse_properties().  Just build the list in-order by having
chain_property() append to the end of the list.

It's theoretically expensive, since we have to walk the list each
time, but frankly I don't think we need to worry about dtc performance
until we actually see a single non-contrived tree that takes a
noticeable amount of time to process:  I've never seen one yet.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson