Rakudo Raku Architecture
image/svg+xml
Rakudo Raku Architecture
rakudo architecture
Mortiz Lentz
The Perl Foundation
https://raw.github.com/rakudo/rakudo/master/docs/architecture.svg
https://raw.github.com/rakudo/rakudo/master/docs/architecture.html
en-US
Core setting(Raku)
The Raku source code is transformed in various stages. The first one is the parser stage, which creates a parse tree out of the Raku source code.
The parser stage is implemented in "Not Quite Perl" (NQP) and is part of Rakudo and hosted in the Rakudo repository.
Parser (NQP)
Parser (NQP)
The action methods are applied to the parse tree at the same time as the parser builds it. The result of this process is the Abstract Syntax Tree that is sent to the QAST compiler.
Action methods (NQP)
Action methods (NQP)
Rakusource
QAST
PIRT serializer (NQP)
QAST compiler (NQP)
IMCC (C)
PIRT
PIR
The POST compiler emits PIR, which IMCC transforms into byte code. IMCC is parrot's PIR compiler, written in C and statically linked into parrot. The byte code (PBC) can then be stored to disk, or executed in memory by a so-called run core or run loop, which is in some sense the heart of parrot - or one of the hearts, because there are several different ones available (one for just-in-time compilation (JIT), one for debugging etc.).
There are also some supporting custom types and operations in Rakudo called dynamic PMCs and dynamic ops which are written in C, and helper functions written in other languages (namely NQP and PIR). Those do not show up in the flow chart.
Parrot runtime (C)
Parrot runtime (C)
PBC
PMC &dynops (C)
JAST serializer (NQP)
QAST compiler (NQP)
Java Virtual Machine
JAST
JVM
Perl6::World(NQP)
MAST serializer (NQP)
QAST compiler (NQP)
MoarVM
MAST
moar