parrotcode: This is the README file for a PIR implementation in PGE. | |
Contents | Language Implementations | PIR |
README - This is the README file for a PIR implementation in PGE.
A good test-case for the compiler tool suite of Parrot is to compile its own assembler. This project aims to bring a full PIR implementation using the Parrot compiler tools.
Currently, only work is done on the parser. Only when the parser is completed should work be done on the further transformations (using TGE in the Parrot compiler tools). When the parser is changed, the generated parse tree will probably be different as well, so any work on the later transformation phases should be redone, which is a pain.
The following is an overview of what is parsed (mostly) correctly:
* most PIR constructs
* recognizes (almost) all Parrot instructions
(but doesn't handle their arguments yet)
See the TODO file for current issues.
The grammar files are split up into several .pg files. This makes the edit-compile-test cycle faster.
Instead of .include-ing the generated files in the main file (pirc.pir), the generated .pir files are compiled to bytecode (.pbc) and loaded in pirc.pir. This prevends compiling all the included files when compiling pirc.pir (which would really be s l o w).
Type
$ make
Easy huh? Please note that compiling may take a while. The compiler is called 'pir.pbc', but the main source file is called pirc.pir, otherwise it would be "pir.pir", which is kinda strange.
After that, you can run the test suite:
$ make test
which will run a little perl script that runs all files in the examples directory.
The 'examples' directory contains a number of test files that are working. Running these can be done by typing:
$ ../../parrot pir.pbc examples/hello.pir
I stole the Makefile from Punie. The compiler driver (main file) is assembled from code from Punie, ABC and Pheme (although I changed a lot, so some things taken might be gone already).
Thanks to Jerry "particle" Gay for fixing numerous platform issues. Thanks to Will "Coke" Coleda for helping setting up the test harness stuff.
Klaas-Jan Stol <parrotcode@gmail.com>
|