README.pod - This is the readme file for PIRC, a PIR Compiler written in C.


This is the readme file for PIRC, a PIR Compiler written in C.


This is an attempt to implement Parrot Intermediate Representation (PIR) using a top-down approach. This is still in its early phases, and only the parser is being worked on.

As the current implementation of PIR (IMCC) is a bit messy, this is an attempt to write a clean implementation to see what constructs should be allowed, and which should be forbidden. It's also a nice experiment to see whether a top-down parser has any advantages over a YACC implementation. (For instance, it's much smaller).

This implementation is as complete as I can currently oversee. Of course, things will be fixed as I encounter them.

More importantly, ops cannot be parsed yet, because the distinction between an op and a plain identifiers can only be decided during runtime. This is because Parrot allows for runtime loading of op-libraries. Currently, I hardcoded the "print" op, so you can compile:

 .sub main :main
   print "Hello World"

On the other hand, most of the "sugar" that PIR adds to Parrot assembly syntax has been implemented, and can be parsed successfully.

For more documentation, please run:

 make docs

This will generate the documentation in HTML format. The documentation of pirparser.c contains the grammar that is accepted by PIRC. The documentation of pirlexer.c contains the lexical specifiction as accepted by PIRC. See the doc directory for documentation, or run perldoc on the source files.


Some highlights of PIRC:


Comments, improvements etc. are most welcome and may be sent to the author.


Run make docs and see the generated files in the doc directory.


klaas-Jan stol <parrotcode at gmail dot com>