xevian has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Parse::RecDescent now, and though it seems to handle anything I throw at it, it takes it's time :) The grammar for my language is fairly large, and just instantiating the parser takes almost 3 seconds (not to mention actually parsing something). I'm looking for ways to speed this up.

The grammar won't change very often, so I've been trying to use Storable to store and retrieve the RecDescent data structure
# store it my $parser = new Parse::RecDescent( GetGrammar() ); store( $parser, $PARSER_LOCATION ); ... # retrieve it later my $parser = retrieve( $PARSER_LOCATION );
The problem I get is this:
Unknown starting rule (Parse::RecDescent::namespace000001::rule) calle +d
I'm not sure exactly what is happening now... but it doesn't seem that storing the instantiated parser is working. Has anyone tried this / know if what I'm trying to do is possible / feasible?

Thanks in advance,
Brian

Replies are listed 'Best First'.
Re: freezing RecDescent
by samtregar (Abbot) on May 04, 2005 at 17:40 UTC
      I indeed did... that's exactly what I need. Thanks!