Parrot: PIR Directive Reference

Last modification: 2008/07/20 23:55

PIR Directive Reference

This is a list of all directives which are valid and/or useful in a PIR context.


Define a named constant of a given type.
.const {type} {name} = {value}

.const int b = 6;

Define a named constant that is visible throughout the current file.
.globalconst {type} {name} = {value}


.macro, .eom
In-place code replacement using named variables
.macro {name} ({var1}, {var2}, ...)

.macro swap (A, B, TEMP)
.TEMP = .A # Note: use '.A', not 'A' within macro
.A = .B
.B = .TEMP

.sub, .end
.arg, .begin_return, .return, .end_return
Standard subroutine call, capable of both taking and returning multiple arguments
.sub {name}
.arg {type} {var1}
.arg {type} {var2}
.return {var1}
.return {var2}

Also see the official Parrot reference.