Chapter 12 · 31 July – 17 September
RakuAST and slangs
RakuAST is the syntax tree Rakudo is moving its front end to, and a public API programs can use: build a tree, print it back as Raku, run it. For a tree-walking interpreter, adopting it as the internal tree would have been expensive. Raku++ took a different route: its RakuAST is a view built on request, and it cost the ordinary path nothing. Then slangs ran for real, lifting the restraint the compiler had been built on.
use L10N::XX at v3.28.0 (14 now)fib, the RakuAST tree has 39 nodes where Raku++'s own has 17. So RakuAST in Raku++ is built only when .AST is called, over the parse the engine already has.- Deferred, with the numbers. The design was written down and put aside: about 2.3× the nodes and 2.1× the visits in the
fibinner loop, if the internal tree were replaced. - The trigger. RakuAST became the default front end in Rakudo 2026.09. The ecosystem sweep already had a dozen distributions, the Intl and L10N families, failing on
.AST. - Every phase in two days.
.DEPARSErenders a tree back to Raku as Rakudo does, 57 of 57..EVALruns a tree..ASTbuilds one from source.--rakuastprints it. Thenvisit-children, and the documentation view. - RakuAST, a formatter, and Raku in your own language. An interleaved A/B over sixteen kernels against the release before: mean −1.3%, worst +2.7%. The design argument had been that it would cost nothing, and it did not.
Measured, then left out
Two things were not built, because measurement said not to. .parent answers Nil for every tree a program can actually obtain in Rakudo, and storing a parent link would make every tree a reference cycle in an engine that counts references. And a RakuAST node is a graph, not a tree: the same node can be reached along two paths.
Raku in your own language
With use L10N::DE; (or JA, AF, CY, EO, FR, HU, IT, NL, PT, ZH) a program is written with that language's keywords. In Raku++ it is a rewrite of the token stream between the lexer and the parser, and it needs no flag. Rakudo 2026.08 needs RAKUDO_RAKUAST=1 for these modules. Latvian, Russian and Ukrainian followed on 19 September.
A formatter
rakupp --fmt rewrites a program's layout and refuses whenever the result would parse differently. Over 757 files in the repository it refused once; over 954 corpus programs, never; over 723 installed ecosystem modules, ten times.
Slangs, for real
A slang is a module that changes how Raku is parsed: Roman numerals, number bases, emoji operators. The first attempt on 9 September recognised one slang by name and imitated it. It was reverted the same day. The plan was rewritten to run the slang's own code instead. On 13 September slangs ran: the module is loaded at use time in a second interpreter, and its tokens become seams in the C++ lexer.
- Why it mattered.
Text::CSVis written in a slang, and eight distributions were waiting behind it. - The lexer had to learn tolerance. Numerals like
₃₆123or 十二 stopped the lexer before it even reached theusethat turns the slang on. - Rakudo decides. Under
Slang::Piersing,$x?is a variable namedx?. A protection borrowed from another engine's design said otherwise, and running the reference compiler overruled it. - A second interpreter is not free. Running one in the same process re-points nine process-wide statics. Missing one caused an intermittent crash in one of
Text::CSV's tests.
v4.0.0 shipped it: eight slangs run their own tokens, and Slang::Tuxic runs as modes. It is also the point where the founding restraint of the compiler chapter was lifted: the parser now runs user code, and programs still compile.