Parrot Virtual Machine/IMCC and PIRC
IMCC and PIRCEdit
IMCC and PIRC are two separate parsers for PIR and PASM. Both are written using Lex and Yacc.
IMCC, the Intermediate Code Compiler is the current front-end for Parrot that reads PASM and PIR code. It's a relatively old subsystem, and has proven itself difficult to extend or maintain. IMCC will likely be the "official" parser for PIR and PASM until the Parrot 1.0 release. However, the plan for the future is to move to a more extensible and more manageable parser, such as PIRC.
IMCC is written using a combination of a Lex tokenizer and a Yacc parser. It includes a number of components, such as register allocators, and code optimizers.
PIRC is, in theory anyway, a better alternative to parsing PIR and PASM than IMCC is. However, PIRC is not currently complete, and does not offer the feature set of IMCC yet. There are two different implementations of PIRC: one is a hand-written recursive descent parser, and the other is based on a multi-stage Lex/Yacc parser. The old version, the hand-written recursive descent version, is obsolete and is no longer maintained. We will only talk about the new implementation of PIRC here.
PIRC is divided into three different parsers:
- A parser for "Heredoc" constructs, strings which are embedded directly into the file.
- A macro parser and text replacer. This is a preprocessor for handling macros and constants.
- A parser for the rest of PIR and PASM
Breaking things up like this proves to keep things much more simple, and reduces the number of states and conditionals that a single large parser would require.
PIRC Current StatusEdit
|PIRC is under active development, and its state may change rapidly. This page may become obsolete. Always refer to the latest documentation in the Parrot repository to get more accurate information about Parrot's current state.|
PIRC is intended to replace IMCC as the primary front-end to Parrot. However, this changeover might not be made until after the 1.0 release of Parrot. In other words, it's an important development, but the Parrot developers aren't going to wait around for it.