http://www.perlmonks.org?node_id=607602

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

Monks -

I've suddenly become interested in learning how to write a grammar. Once I get the hang of it, I might write a grammar for something useful (who knows?).

I know that there is Parse::RecDescent but after seeing the syntax used in Perl-6.0.0-STD.pm, I think I'm missing something.

The syntax used in that file is clear and instantly recognizable. Where can I learn more?

Thanks!

Replies are listed 'Best First'.
Re: Writing a Grammar?
by planetscape (Chancellor) on Mar 31, 2007 at 03:35 UTC
Re: Writing a Grammar?
by NetWallah (Canon) on Mar 31, 2007 at 05:21 UTC
    I continue to enjoy using merlyn's Inline::Spew module, which generates text based on a user-defined grammar. Wonderful for Mission statements, and performance reviews!.

    It, in turn, uses Parse::RecDescent, but hides the complexities.

         "Choose a job you like and you will never have to work a day of your life" - Confucius

Re: Writing a Grammar?
by adrianh (Chancellor) on Apr 01, 2007 at 08:06 UTC
    I know that there is Parse::RecDescent but after seeing the syntax used in Perl-6.0.0-STD.pm, I think I'm missing something.

    What you're missing is that the latter is Perl 6 :-)

    For another approach to parsers in Perl 5 you might want to take a look at HOP::Parser.

Re: Writing a Grammar?
by jdrago_999 (Hermit) on Apr 02, 2007 at 17:00 UTC
    Thanks to everyone for your replies - I'll look into the options presented.