11.2 PIR Directives

   

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   VAL   

Push a value onto the user stack or set it according to PCC.

.const

 .const   TYPENAME   =   VALUE   

Define a named constant.

.constant

 .constant   NAMEVALUE   

Define a named macro that expands to a given value. Macros are called as directivesi.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   PArray   

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

.globalconst

 .globalconst   TYPENAME   =   VALUE   

Define a named, file visible constant.

.include

 .include "   FILENAME   " 

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

.invocant

 .invocant   OBJ   

Set the invocant for a method call.

.local

 .local   TYPENAME   

Define a local named variable.

.macro

 .macro   NAME   (   PARAMS   ) 

Define a named macro with a list of parameters. The macro is called as:

 .   NAME   (   arg1   ,   arg2   , . . . ) 

This directive is always paired with .endm .

.meth_call

 .meth_call   SUB   .meth_call   SUB   ,   RETCONT   

Create a method call.

.namespace

 .namespace   [ "namespace" ]   

Define a namespace.

.nci_call

 .nci_call   SUB   

Create an NCI call.

.param

 .param   DEST   .param   TYPENAME   

Pop a value off the user stack into a register or typed identifier.

.pcc_begin

Start a call sequence. Always paired with .pcc_end .

.pcc_begin_return

Start a return sequence. Always paired with .pcc_end_return .

.pcc_begin_yield

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

.pcc_call

 .pcc_call   SUB   .pcc_call   SUB   ,   RETCONT   

Create a subroutine call.

.pcc_sub

 .pcc_sub   _LABEL   

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

.pragma

 .pragma fastcall .pragma prototyped 

Set default calling conventions.

.result

 .result   DEST   

Pop a value off the user stack or get it according to PCC.

.return

 .return   VAL   

Return a value to the calling subroutine by pushing it onto the user stack or set it according to PCC.

.sub

 .sub   NAME   

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

.sym

 .sym   TYPE     NAME   

Same as .local .



Perl 6 and Parrot Essentials
Perl 6 and Parrot Essentials, Second Edition
ISBN: 059600737X
EAN: 2147483647
Year: 2003
Pages: 116

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net