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

Hi, I have a quite large file (~200MB) which is in a certain language. I have the BNF of this language and would like to parse it to another language. I tried using Parse::Recdescent for this, but it is VERY slow as it parses everytime the whole file, tries to match a rule and if it doesn't match it parses the whole file to match another rule. Doing so, it gets very painful after some time and usually the program quits after a while being out of memory. Is there any better way to do so? I really like to use perl for this purpose and use a real parser. Thanks, Amir

Replies are listed 'Best First'.
Re: Perl parser for large file
by moritz (Cardinal) on Feb 25, 2009 at 10:09 UTC
    Maybe Parse::Yapp or some other interface to a C based parsing generator are applicable for you, they tend to be much faster.

    Or perhaps py, a very clever thing...

    Update: another option might be Parse::Marpa.