Mike Diehl reported back:

> I did finally, rewrite the whole thing using the second approach.  This was
> CONSIDERABLY more complex, as I had to navigate a fairly complex parse tree.
> I think I've done something wrong, as I'm still finding bugs...  I'll do some
> more reading, though.

One way to make the job easier is to have P::RD bless each node in
your parse tree
(look up "Autotrees" in the module documentation or take a look at
demo_LaTeXish.pl
and demo_eval.pl that come with the module). Then you create methods
in each of the
node classes, and let them work out the tree traversal themselves.


> Anyway, this is a nice final design, though.  Because I now have a parse tree,
> I have the potential of serializing that data structure to an external file
> and saving the expense of launching the parser each time my program runs.
> This amounts to creating a JIT compiler!  Should be MUCH more efficient,
> right?

Yes, it should be.


> Any recommendations between the various modules for this purpose?
> Data::Dumper, Storable, Serialize?

I tend to use Data::Dumper myself.


> BTW Damian, RD is a nice piece of work.  It's almost FUN to use.

Glad you're finding it useful.

Damian

Reply via email to