Raku++ — the fastest Raku compiler

I have been following the development of the Raku programming language since the very beginning. It was Perl 6 for many years, and I had a dream to start using it in real projects. Honestly, I could, to some extent.

The timeline for the last 20+ years was not linear at all, and had its own unexpected changes. After a hope with a quick Parrot, there was an unbelievably powerful Pugs and a few other projects. It was Rakudo that carried the language forward and became its leading implementation. It’s a massive project with great Raku coverage.

I always wanted to create a Raku compiler myself. Over the years, I made a few half-serious attempts, but as the language is indeed huge, I soon understood it was not feasible. After the rename, around 2020, I thought we could approach some Big Tech companies to ask them to make an industrial compiler for us. Actually, I discovered recently, that I even talked to ActiveState at some point much earlier, when it was still Perl 6.

The reality is if you want to have a compiler, the only option is to make it yourself. OK, today, we have great friends and helpers, AI.

And here, let me present my brand new Raku compiler, Raku++.

It is now available for macOS, Linux, and Windows as binaries of the release 0.5.1, and of course you can compile it from source. The code is written in C++.

The compiler in its current state covers about 82% of the Roast test suite, which is the official test suite for Raku as a programming language. Inside the repository, there are some tools, which are written in Raku and can be executed by Raku++ itself. I also applied the compiler to my fully Raku-based projects, Covid.observer and The Complete Course of the Raku Programming Language. Both of them have generator tools, written in Raku. And as I am working on proofreading the Course at the moment (that’s the topic of a separate announcement), I’ve been running the generator tools again and again. The fact that Raku++ is so fast helps a lot.

I would not copy-n-paste the documentation here, but I’d like to highlight a few most important things about Raku++.

  • It’s a compiler covering about 82% of the official test suite.
  • There are interpreter and compiler modes, the latter is able to generate native code.
  • The interpreter is fast, the native code is obviously even faster. There’s also the -O optimising option for the compiler.
  • What I am enjoying the most is that the start-up time is just a few milliseconds, so when using rakupp (that’s the name of the executable file of Raku++), you feel the spirit of real programming and working with a fast and responsive computer, as it should be. You press Enter and get the result immediately.
  • Raku++ is written in C++, hence the name.

Explore the documentation in the repository, it’s an enjoyable read.

On a separate nostalgic note, I revived the mandel.p6 program, the one that was shipped with Parrot and printed the Mandelbrot fractal in the console. Here it is again on new ground:

................::::::::::::::::::::::::::::::::::::::::::::...............
...........::::::::::::::::::::::::::::::::::::::::::::::::::::::..........
........::::::::::::::::::::::::::::::::::,,,,,,,:::::::::::::::::::.......
.....:::::::::::::::::::::::::::::,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::....
...::::::::::::::::::::::::::,,,,,,,,,,,,;;;!:H!!;;;,,,,,,,,:::::::::::::..
:::::::::::::::::::::::::,,,,,,,,,,,,,;;;;!!/>&*|& !;;;,,,,,,,:::::::::::::
::::::::::::::::::::::,,,,,,,,,,,,,;;;;;!!//)|.*#|>/!;;;;;,,,,,,:::::::::::
::::::::::::::::::,,,,,,,,,,,,;;;;;;!!!!//>|:    !:|//!!;;;;;,,,,,:::::::::
:::::::::::::::,,,,,,,,,,;;;;;;;!!/>>I>>)||I#     H&))>////*!;;,,,,::::::::
::::::::::,,,,,,,,,,;;;;;;;;;!!!!/>H:  #|              IH&*I#/;;,,,,:::::::
::::::,,,,,,,,,;;;;;!!!!!!!!!!//>|.H:                     #I>!!;;,,,,::::::
:::,,,,,,,,,;;;;!/||>///>>///>>)|H                         %|&/;;,,,,,:::::
:,,,,,,,,;;;;;!!//)& :;I*,H#&||&/                           *)/!;;,,,,,::::
,,,,,,;;;;;!!!//>)IH:,        ##                            #&!!;;,,,,,::::
,;;;;!!!!!///>)H%.**           *                            )/!;;;,,,,,::::
                                                          &)/!!;;;,,,,,::::
,;;;;!!!!!///>)H%.**           *                            )/!;;;,,,,,::::
,,,,,,;;;;;!!!//>)IH:,        ##                            #&!!;;,,,,,::::
:,,,,,,,,;;;;;!!//)& :;I*,H#&||&/                           *)/!;;,,,,,::::
:::,,,,,,,,,;;;;!/||>///>>///>>)|H                         %|&/;;,,,,,:::::
::::::,,,,,,,,,;;;;;!!!!!!!!!!//>|.H:                     #I>!!;;,,,,::::::
::::::::::,,,,,,,,,,;;;;;;;;;!!!!/>H:  #|              IH&*I#/;;,,,,:::::::
:::::::::::::::,,,,,,,,,,;;;;;;;!!/>>I>>)||I#     H&))>////*!;;,,,,::::::::
::::::::::::::::::,,,,,,,,,,,,;;;;;;!!!!//>|:    !:|//!!;;;;;,,,,,:::::::::
::::::::::::::::::::::,,,,,,,,,,,,,;;;;;!!//)|.*#|>/!;;;;;,,,,,,:::::::::::
:::::::::::::::::::::::::,,,,,,,,,,,,,;;;;!!/>&*|& !;;;,,,,,,,:::::::::::::
...::::::::::::::::::::::::::,,,,,,,,,,,,;;;!:H!!;;;,,,,,,,,:::::::::::::..
.....:::::::::::::::::::::::::::::,,,,,,,,,,,,,,,,,,,,,,:::::::::::::::....
........::::::::::::::::::::::::::::::::::,,,,,,,:::::::::::::::::::.......
...........::::::::::::::::::::::::::::::::::::::::::::::::::::::..........

So, enjoy Raku++: https://github.com/ash/rakupp

Leave a Reply

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