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

I have a 26KB grammar file that needs to be precompiled using the special magic that Parse::RecDescent provides us using the command:

perl -MParse::RecDescent - myfile.pl My::Compiled::Grammar

When running this script on "myfile.pl", the system chugs away (for at least 30 seconds or so, with the typical 95+% CPU usage), creating the Grammar.pm file... but it's incomplete... the app doesn't quit and instead seems like it's still chugging away. The total memory usage then hits at least 950MB (tonnes of disk swapping starts going on), while the Perl process now sits at only a few percent CPU usage... after about 5 minutes, I'll do a CTRL-C at the command-line and look at the Grammar file, but it's incomplete... I can tell that by the mismatched parentheses and just by looking you know it didn't really finish...

Should I have continued waiting for it finish up? Or is there a problem with the size of my grammar? I didn't get any warnings when doing the pre-compile, and running it in my own file there are no warnings as well.

I'm running this on ActivePerl 5.6.1 on a Win2K box and the latest version of Parse::RecDescent.

Any ideas? Anyone want access to the file so they can see if it precompiles on their box? Perhaps a UNIX box could do the trick? I dunno, but I gotta get this precompiled because it takes over 10 seconds each time I run my app.

Replies are listed 'Best First'.
Re: Parse::RecDescent Precompiler Issues - It Hangs on Large Grammar
by Juerd (Abbot) on Mar 14, 2002 at 22:21 UTC

    Have a look at Parse::RecDescent size limit?, especially merlyn's explanation of the nibbling approach.

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk