|Version 7 (modified by kjs, 5 years ago)|
PIRC is a fresh implementation of the PIR language. It was developed as a replacement for the current PIR compiler, IMCC. The lexer and parser are implemented with Flex and Bison specifications. During the parsing phase, a data structure is built that represents the parse. After the parse, this data structure is traversed and for each instruction the appropriate bytecode is emitted.
PIRC is located in compilers/pirc. In order to compile, do the following:
cd compilers/pirc make make test
At this point (August 5, 2009) some tests are failing, so don't be alarmed if you see them failing.
In order to run PIRC:
./pirc -h ./pirc -b test.pir # will generate a file a.pbc
PIRC is not complete yet. All stages are implemented (lexer, parser, bytecode generator), but all of them need some additional work to complete them. See the section below for the specific items that need to be fixed. Once these are fixed, PIRC will be done about 98%.
PIRC Development Tasks
- ticket #43: autoheaderize all PIRC sources.
- ticekt #55: decorate all function arguments with ARGIN macros etc.
- write tests for the generated output.
Hardcore hacking tasks
- Fix parser to accept syntax such as:
$P0 = new ['Integer']
- Convert all C strings in PIRC into STRINGs. All identifiers and strings that are scanned should be stored as STRING objects, not C strings.
- Fix ticket #198. It seems that when there is a sequence of more than one instruction dealing with STRINGs or NUMs, the resulting bytecode segfaults. Apparently, PIRC is emitting the wrong bytecode. Bug #186 is related to this issue.
- Fix ticket #173. Lexicals are not stored correctly in the generated bytecode. The code for storing the lexicals is taken from IMCC, and therefore it doesn't come as a complete surprise it's not working. However, I don't see what's wrong.
- Fix ticket #14. Braced arguments to macros are not handled correctly. Nested macro expansion isn't correctly handled yet.
- Fix ticket #163. Keyed multi types must be implemented