Grammars in Perl 6

I don’t intend to make it a habit to post solely link posts here, but I felt I had to make an exception for today’s Perl 6 Advent Calendar post. (I don’t intend to limit myself to Perl 6 either, by the way, it’s just easy during the month of December.)

It’s about grammars in Perl 6, which are both groups of regexes and actually for all intents and purposes similar to parser grammars. People claimed that regular expressions were inadequate to solve parsing needs but just easy and approachable enough to make them more attractive than just writing a parser, and they were right. Perl 6 now does a fine job of attempting to solve this by rebuilding regular expressions into actual parsers, and making parsing easy by being a first-class citizen of the language.

How first-class? As shown by the final gift under last year’s tree, Perl 6’s own syntax is enshrined in a Perl 6 grammar. If it can parse Perl (if Perl 6 and not Perl 5), it’s probably good enough for most things you want to throw at it.

Leave a Reply

Your email address will not be published. Required fields are marked *