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.

Constants

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

.const int b = 6;

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

Procedures

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

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

.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}
...
.begin_return
.return {var1}
.return {var2}
.end_return
.end

Also see the official Parrot reference.