Re: Deferred interpretation?
[email protected] (Damian Conway) Thu, 10 Sep 2009 20:49:04 +1000
| Newsgroups | perl.recdescent |
|---|---|
| Message-ID | <[email protected]> |
Mike Diehl reported back: > I did finally, rewrite the whole thing using the second approach. =A0This= was > CONSIDERABLY more complex, as I had to navigate a fairly complex parse tr= ee. > I think I've done something wrong, as I'm still finding bugs... =A0I'll d= o 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. =A0Because I now have a pars= e tree, > I have the potential of serializing that data structure to an external fi= le > and saving the expense of launching the parser each time my program runs. > This amounts to creating a JIT compiler! =A0Should 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. =A0It's almost FUN to use. Glad you're finding it useful. Damian