Grammars and slangs

This site (in construction) will promote raku language grammars and slangs by providing tools to explore them and access documentation. For lack of tooling, slangs are not even an official feature of raku when it is the very thing that distinguish it from other languages. Raku fully supporting slangs will make in a principled way what Perl did very successfully as a hack. It was said that "Perl duct tape that holds the Internet together". in essence making more rigid tools cooperate with each other. That is in other word, being capable of process ther output and generate output suitable to them.

Tooling

This site wiil eventually make its tools available to languages other than raku by making them a wasm based engine. Rust code could be used as a starting point. Eventually having a a streamlined grammar for Svelte 5 would be nice.

To do so, we create pedagogical tools to learn about parsing with grammars. We do so by using yaml parsetrees and maybe the ASTs. These tools are prototyped on this site but are intended to eventually be available in vscode. The original version of the site at slangs.vercel.app is static because it has no acces to the raku compiler.

Literate Widget

The workhorse of this site is the Literate widget. The literate Widget is intended to be used in blogs, article and documentation. It will support highlighting of code. But often the example is too advanced or the reader want to go on a tangent. But for now let us explore a simple case.

The example shown here is a test case. The parsed text is:

The grammar to parse it is below. It is the simples grammar intended to exercice most of the features of the parse tree browser :

The parse tree is :

The unexpanded widget will show only the parsed text.

Expanded Literate

An expanded Literate Widget will be full screen. But for sake of illustration it is not full screen here. Think it as a playground but with some savvy which allows to display doc information.

Parse tree

The expanded literate widget will be used to explore the parse tree generated from the code. On the left is the code. In the right one can choose between the parse tree generated from the code and a pane which displays the rules used to parse the code (TBD).

Yaml slang

A yaml slang will be provided derived from yamlish. It will be used to write code to drive test and refactoring. As a slang it will not be a simple raku string but an syntax highlighted parsed entity which parsetree can be explored with Literate widget.