Directive Reference

This is a summary of PIR directives. Directives are preprocessed by the Parrot interpreter. Since PIR and PASM run on the same interpreter, many of the directives listed here are also valid in PASM code.

.arg

  .arg R<VAL>

pass a value to a subroutine according to PCC.

.const

  .const R<TYPE>R<NAME> = R<VALUE>

Define a named constant.

.macro_const

  .macro_const R<NAME>R<VALUE>

Define a named macro that expands to a given value. Macros are called as directives, i.e. .NAME (PASM code only).

.emit

  .emit

Define a compilation unit of PASM code. Always paired with .eom.

.end

  .end

End a compilation unit. Always paired with .sub.

.endm

  .endm

End a macro definition. Always paired with .macro.

.eom

  .eom

End a compilation unit of PASM code. Always paired with .emit.

.flatten_arg

  .flatten_arg R<PArray>

Flatten the passed array PMC and provide args for PCC calls.

.globalconst

  .globalconst R<TYPE>R<NAME> = R<VALUE>

Define a named, file visible constant.

.include

  .include " R<FILENAME> "

Include the contents of an external file by inserting it in place.

.invocant

  .invocant R<OBJ>

Set the invocant for a method call.

.local

  .local R<TYPE>R<NAME>

Define a local named variable.

.macro

  .macro R<NAME> (R<PARAMS>)

Define a named macro with a list of parameters. The macro is called as .NAME(arg1,arg2,...). Always paired with .endm.

.meth_call

  .meth_call R<SUB>
  .meth_call R<SUB>, R<RETCONT>

Create a method call.

.namespace

  .namespace R< [ "namespace" ] >

Define a namespace.

.nci_call

  .nci_call R<SUB>

Create an NCI call.

.param

  .param R<DEST>
  .param R<TYPE>R<NAME>

Define a subroutine parameter.

.begin_call

Start a call sequence. Always paired with .end_call

.begin_return

Start a return sequence. Always paired with .end_return

.begin_yield

Start a return of a coroutine sequence. Always paired with .end_yield

.call

  .call R<SUB>
  .call R<SUB>, R<RETCONT>

Create a subroutine call.

.pcc_sub

  .pcc_sub R<_LABEL>

Create a symbol entry for subroutine at the _LABEL. This directive is for PASM code only.

.result

  .result R<DEST>

Get a return value according to PCC.

.return

  .return R<VAL>

Return a value to the calling subroutine according to PCC.

.sub

  .sub R<NAME>

Define a compilation unit. Always paired with .end. Names begin with "_" by convention.

.sym

  .sym R<TYPE> R<NAME>

Same as .local.