# creating a slang secosystem

This site will advertise raku grammars and slang. It is currently in its early state.

some history and concepts

More than 20 years ago, Damian Conway created in Perl a mostly declarative system of grammars to parse programs written in languages using rich syntax. He made regular expressions composable by making them methods in an OO system. He called such mehods rules. Grammar are classes that include rules in addition to regular methods. Perl was good to prototype such a system but it was dog slow.

Grammars are a main part of Raku [1] [2] the putative Perl successor. It leverages raku modern OO. And its current implementation is very close to the original design uses such a grammar to parse itself.

In fact it is the composition of many grammars. Grammars can be composed and extended dynamically. One can use a class Actions associated to a grammar to build an AST, a step to create a language compiler from the parse tree. A language which hooks on an existing language is called a slang. Liz created Slangify to streamline the process of creating a slang.

This would be fine and dandy if an ecosystem would be build around that to provide treesitters and syntax highligting.

Currently beside the Comma editor, syntax highlighting is broken for raku is broken in all editor even for trivial programs. So writing program in a given slang is a non starter for anyone expecting decent support from the editor. Nowhere LSP is supported.

Ongoing

  • from any code, generating a parsetree dump in yaml from nqp and raku
  • using the generated yaml to drive the navigation of code displayed in a Monaco widget using a crumbbar

TBD

  • Porting raku grammar engine in rust [1] [2] to run in wasm
  • Given the production rule of code under the cursor, display the code of the fule.
  • Implementing the crumbar in vscode. That can’t be an extension but a modif to the core.

algorithm and main core data structure

A parse tree is generated as a yaml text in a very compact form. It is loaded and used by the routine calcCrumbs to generate the crumbs at a given position.

The version that runs on vercel uses pregenerated parse trees like this generated by the nqp program.