Categories
Posts in this category
- A shiny perl6.org site
- Creating an entry point for newcomers
- Sprixel, a 6 compiler powered by JavaScript
- Another perl6.org iteration
- Blackjack and Perl 6
- Why I commit Crud to the Perl 6 Test Suite
- Report from the Perl 6 Hackathon in Copenhagen
- Custom operators in Rakudo
- Defined Behaviour with Undefined Values
- Dissecting the "Starry obfu"
- Perl 6: Failing Softly with Unthrown Exceptions
- The first Perl 6 module on CPAN
- Google Summer of Code Mentor Recap
- Building a Huffman Tree With Rakudo
- Immutable Sigils and Context
- Is Perl 6 really Perl?
- Perl 6: Lost in Wonderland
- Lots of momentum in the Perl 6 community
- Musing and the future of feather and the Pugs repository
- Musings on Rakudo's spectest chart
- My first executable from Perl 6
- Trying to implement new operators - failed
- Let's build an object
- Perl 6 is optimized for fun
- How to get a parse tree for a Perl 6 Program
- Perl 6 in 2009
- Perl 6 ticket life cycle
- The Perl 6 Advent Calendar
- How to Plot a Segment of a Circle with SVG
- Publicity for Perl 6
- Rakudo architectural overview
- Rakudo Rocks
- Rakudo "star" announced
- Rakudo's rough edges
- Rats and other pets
- Releasing Rakudo made easy
- Set Phasers to Stun!
- Starry Perl 6 obfu
- Recent Perl 6 Developments August 2008
- Strings and Buffers
- Subroutines vs. Methods - Differences and Commonalities
- A SVG plotting adventure
- A Syntax Highlighter for Perl 6
- Test Suite Reorganization: How to move tests
- The Happiness of Design Convergence
- Perl 6 Tidings from September and October 2008
- Perl 6 Tidings for November 2008
- Perl 6 Tidings from December 2008
- Perl 6 Tidings from January 2009
- Perl 6 Tidings from February 2009
- Perl 6 Tidings from March 2009
- Perl 6 Tidings from April 2009
- Perl 6 Tidings from May 2009
- Perl 6 Tidings from May 2009 (second iteration)
- Perl 6 Tidings from June 2009
- Perl 6 Tidings from August 2009
- Perl 6 Tidings from October 2009
- Timeline for a syntax change in Perl 6
- Visualizing match trees
- We write a Perl 6 book for you
- When we reach 100% we did something wrong
- Where Rakudo Lives Now
- Why was the Perl 6 Advent Calendar such a Success?
- What you can write in Perl 6 today
- Why you don't need the Y combinator in Perl 6
Fri, 17 Jul 2009
Rakudo architectural overview
Permanent link
The other day Su-Shee asked on IRC if I could tell her which components of Rakudo are written in which programming language. So here it is:

The source code is entered at the top of the machine named Rakudo, and is transformed in various stages. The first two, parser and action methods, are actually part of Rakudo, and are hosted in the Rakudo repository. They are written in two different subsets of Perl 6, the regexes (parser), and "Not Quite Perl 6", short NQP (action methods).
The next two stages (PAST and POST compiler) are part of the so-called "Parrot Compiler Toolkit", short PCT. Both PAST and POST are structural representations of the program, with PAST being more high-level than POST. Both compilers are written in PIR, the parrot assembly language, and are distributed along with parrot. They are also used by many other parrot based languages.
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.
The part of Rakudo described so far is the stage one compiler.
In the build process it is compiled first, and then it compiles the setting
library down to PBC. "Setting library" is a fancy term describing the
built-in functions which are written in Perl 6. The result of this compilation
(together with a low level runtime library in PIR) is linked together with the
stage one compiler and parrot, the result is the perl6
executable.
Glossary
- PGE
- Parrot Grammar Engine, parrot's grammar engine for Perl 6 regexes and grammars.
- NQP
- Not Quite Perl 6, a small subset of Perl 6 that is used for tree transformations in compilers.
- PAST
- Parrot Abstract Syntax Tree, an in-memory representation of structures common to many programming languages (like variable declarations, branches, loops, subroutine calls).
- POST
- Parrot Opcode Syntax Tree, an in-memory low level representation of programs.
- PCT
- Parrot Compiler Toolkit, a collection of tools and compilers useful for writing other compilers.
- PIR
- Parrot Intermediate Representation, the most commonly used for of parrot assembly (which is still high-level enough to be written by humans).
- IMCC
- InterMediate Code Compiler, the part of parrot that compiles PIR into byte code.
- PBC
- Parrot Byte Code, the binary form to which all parrot programs are compiled in the end.
Comments / Trackbacks:
Trackback URL:
/blog-en/perl-6/rakudo-overview.trackback
Lucas wrote
Very good! Thanks.
Ben Petering wrote
Thanks for this one. It's good to see a higher-level technical overview of the project(s). And graphs are good :)
Write a comment
The comments on this blog post have been disabled; the comment form below will not work.