Title ^

Roadmap for languages/PIR

Intro ^

This document describes a roadmap for languages/PIR, the PIR implementation using the Parrot Compiler Tools: PGE and TGE.

This document does NOT describe IMCC, the current implementation of Parrot Intermediate Representation (PIR) used by Parrot.

Neither does this document describe a TODO list; you can find that list in the, you guess it, TODO file.

What's the goal of languages/PIR? ^

The goal is to have a PIR implementation in PIR itself :-)

Just like most C compilers are implemented in C, it'd be nice to define PIR in PIR itself. Moreover, this is a good test-case of the Parrot Compiler Tools Suite (PCTS), consisting of PGE (for parsers) and TGE (for tree transformations).

Besides PIR, Perl6 and a number of other languages is being implemented using the PCTS.

Another, secondary, goal is to *define* PIR; there is not yet a final description that precisely states the grammar of PIR. (The Yacc input file is big and hard to read). This also gives the opportunity to clean up the grammar, and present a nice and clean grammar for Parrot 1.0.

Where is languages/PIR now? ^

Currently, work is being done on the PIR parser. The parser is being implemented using the Parrot Grammar Engine (PGE), that implements the subsystem of Parrot that will process Perl6 regex-es and rules.

Where is languages/PIR going? ^

As soon as the parser is done, there should be a simple processing pass that reads the parse-tree and emits PIR instructions. That's right, it will be a PIR->PIR compiler. This works, because currently PIR is already implemented by IMCC, using Lex and Yacc.

Then after that, *and* if there is an API to emit bytecode, (or at least a way to call into Parrot to do the stuff it's supposed to do), the Real Parrot Bytecode can be emitted, so that IMCC can be skipped altogether.

What main tasks need to be done? ^

This is only a top-level view (a.k.a. ROADMAP), for a detailed list, see TODO.

Finish and TEST the parser

Implement a first back-end: emit PIR

Implement a second back-end: call the bytecode API

Author ^

Klaas-Jan Stol <parrotcode@gmail.com>

January 2007