Raku Programming/Implementations

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Pugs
was the first more-or-less functioning implementation of Raku. It was written in Haskell by Audrey Tang. It is now relevant mostly for historical interest.
Niecza
An implementation of Raku using the .net framework.
Rakudo
The leading, high-level implementation of Raku. It is self-hosting, which means that it is written mostly in Raku and a sub-language of Raku: nqp. It targets several process virtual machines: Parrot, JVM, MoarVM, and probably a few others in a near future (JavaScript, Lua, ...)

As of April 2014, Rakudo on MoarVM is the most promising implementation. It is entirely free and open-source software and uses a VM specifically designed for Raku.


Pugs and Parrot[edit | edit source]

After a long period of language design, it was time to start creating an implementation of the new language. To avoid the problems of Perl, it was decided by the initial organizers to create better separation between the back-end execution engine and the front-end language parser. After a number of discussions, the Parrot Virtual Machine project was started to create a virtual machine for dynamic languages like Raku. Parrot quickly grew to become independent of Raku, opting instead to become a virtual machine for all dynamic languages. Since Raku was so large and ambitious, any virtual machine that could support it would also be very capable of supporting many other dynamic languages as well.

Audrey Tang, a Perl hacker, put together a reference implementation of Raku using the Haskell programming language. This implementation was called Pugs, and served as a testbench for many of the ideas that the language designers were developing. Feedback from the Pugs team helped to shape the language design, and changes to the language design caused modifications in Pugs. It was a useful and helpful relationship, especially since no other implementations were at such a high state of development at that time.

STD.pm, STD_blue and ELF[edit | edit source]

The "official" grammar for Raku was going to be written in Raku itself. This is because Raku was being designed to have one of the most advanced grammar engines of any existing language at the time. There simply was no better choice for a grammar implementation for such an advanced language than that language itself. STD.pm was created as the standard Raku grammar, and is still deferred to when conflicts arise in the various implementations.

STD_red is an implementation of the Raku grammar using the Ruby programming language. STD_blue is a more up-to-date compiler for STD.pm that's written in Perl.

ELF is a boot-strapped implementation of Raku that uses STD_blue to compile Raku code into Perl code for execution.

Rakudo[edit | edit source]

When Audrey Tang left the Pugs project, however, development on it dropped to a minimum. It was still useful for testing and reference, but Pugs was no longer the active development platform that it once was. However, Parrot had grown by leaps and bounds since that time and was finally ready to start supporting compilers for high-level languages. A Raku project, known as "Rakudo" was started and began to grow rapidly. Part of the Rakudo project was Patrick Michaud's creation of high-level parser tools called PCT ("Parrot Compiler Tools"). PCT is a parser generator tool similar to the low-level Flex and Bison tools. However, PCT used a subset of the Raku language to write parsers, instead of using C or C++. This meant that Rakudo was on the road to becoming self-hosting: The Rakudo compiler itself was partially written in Raku.

More information about Rakudo can be found on the web at http://www.rakudo.org