Changes between Version 7 and Version 8 of PIRCDevelopment

Show
Ignore:
Timestamp:
08/05/09 18:35:54 (5 years ago)
Author:
kjs
Comment:

ah while i'm at it, some more information on PIRC.

Legend:

Unmodified
Added
Removed
Modified
  • PIRCDevelopment

    v7 v8  
    11= PIRC Introduction = 
    22 
    3 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. 
     3PIRC is a fresh implementation of the PIR language. It is being developed as a replacement for the current PIR compiler, IMCC. Somewhere in the future, we all hope to be able to finish it. However, some help is needed. Most of the tricky parts have been done for you, such as implement all sorts of weird features of the PIR language.  
     4 
     5The basic workflow of PIRC is as follows. The lexer and parser are implemented with Flex and Bison specifications. During the parsing phase, a data structure is built that represents the input. To stick with compiler jargon, let's call this the Abstract Syntax Tree (AST). After the parse, this AST is traversed and for each instruction the appropriate bytecode is emitted. Registers are allocated by the built-in vanilla register allocator. This means that for the following code: 
     6 
     7{{{ 
     8.sub main 
     9  $S12 = "Hi there" 
     10  print $S12 
     11  $I44 = 42 
     12  print $I44 
     13.end 
     14}}} 
     15 
     16$S12 and $I44 will be mapped to the registers S0 and I0 respectively (yes, you guessed it, it starts allocating from 0). As you would expect, the vanilla register allocator is pretty stupid, but the generated bytecode is not too bad, really. If you want to optimize the register usage (which saves runtime memory), you can activate the register optimizer. The register optimizer is based on a Linear Scan Register allocator. The original algorithm, as described in this paper, assumes a fixed number of available registers. Since Parrot has a variable number of registers available per subroutine, the algorithm has been changed here and there. 
     17  
     18= Building and running PIRC =  
    419 
    520PIRC is located in compilers/pirc. In order to compile, do the following: