Ecosystem

A thriving ecosystem of parsers, DSLs, and syntax extensions.

There is a rich landscape of modules that put Grammars to work. They can be found on raku.land. Use, collaborate or publish your own. Here is a selection - they fall into three natural families:

Custom Domain-Specific Languages

These modules define a bespoke mini-language for a particular problem domain. Modules with DSL in the name translate natural-language commands into runnable code in multiple target languages; others define custom grammars for configuration, diagrams, or grammar meta-languages.

Standard-Format Parsers

These modules provide a Grammar and Actions pair for parsing an established, published format or language. Many follow the …ish naming convention — a signal that the module speaks that format natively.

Jinja2 Template

Proto tokens dispatch on sigil — one grammar covers text, expressions, and blocks.

grammar Jinja2 {
    token TOP              { <node>* }
    proto token node       { * }
    token node:sym<text>   { <-[{]>+ }
    token node:sym<expr>   { '{{' \s* <ident> \s* '}}' }
    token node:sym<block>  { '{%' \s* \w+ \s* '%}' }
    token ident            { <[a..z_]> \w* }
}
Cro Template

Named alternation parses each template construct — text, tags, and calls stay distinct.

grammar CroTemplate {
    token TOP             { <node>* }
    proto token node      { * }
    token node:sym<text>  { <-[<]>+ }
    token node:sym<tag>   { '<.' <ident> '>' <node>* '</' <ident> '>' }
    token node:sym<call>  { '<&' <ident> '/>' }
    token ident           { <[a..z\-]>+ }
}

Slangs — Grammar Inside the Language Itself

A slang hooks a Grammar and Actions pair into Raku's own parser, extending the syntax of the language without any preprocessor or macro system. The Slangify module — this site — manages the lifecycle of all such slangs.