IMCC - syntax
This document describes the imcc syntax.
Comments start with # and last until the following newline. These and empty lines are ignored.
A valid imcc program consists of a sequence of statements. A statement is terminated by a newline (<NL>).
[label:] [instruction] <NL>
Optional label for the given instruction, can stand on its own line. Global labels start with an underscore, local labels shouldn't.
Start with a letter or underscore, then may contain additionally digits.
int, float, string or a valid parrot PMC type like PerlArray.
A PASM register I0..I31, S0..S31, N0..N31, P0..P31, or a IMCC temporary register $In, $Sn, $Nn, $Pn, where n consists of digit(s) only. The parrot register P31 is reserved for spilling and should not be used in complex code sections, which might need spilling (see operation.pod).
A local identifier or a reg or a constant (when allowed).
Are delimited by ". A " inside a string must be escaped by \".
Are delimited by '.
0x and 0b denote hex and binary constants.
Define a compilation unit with the label _identifier:.
Define a compilation unit containing PASM code.
Define a local name identifier for this compilation unit and of the given type.
Define a named constant of style type and value const.
Defines the range of a namespace. Local variables inside a namespace are mangled as <namespaceidentifier::varidentifier>.
Like .local and generates PASM restore identifier.
restore from stack.
save on stack.
Directives used for Parrot Calling Conventions.
Instructions may be a valid PASM instruction or anything listed here below:
bsr <identifier>.
branch <identifier>.
Translate to if x, identifier or unless ...
The relop <, <=, ==, != >= > translate to the PASM opcodes lt, le, eq, ne, ge or gt var, var, identifier.
Like above, but branch if condition isn't met.
set var, var
The unarys !, - and ~ generate not, neg and bnot ops.
The binarys +, -, *, /, % and ** generate add, sub, mul, div, mod and pow arithmetic ops. binary . is concat and valid for string arguments.
<< and >> are arithmetic shifts shl and shr. >>> is the logical shift lsr.
&&, || and ~~ are logic and, or and xor.
&, | and ~ are binary band, bor and bxor.
This generates either a keyed set operation or substr var, var, var, 1 for string arguments and an integer key.
A keyed set operation or the assign substr op with a length of 1.
new var, .type
new var, .type, var
defined var, var
defined var, var[var] the keyed op.
store_global "string", var
find_global var, "string"
clone var, var
set_addr var, var
parsing.pod, calling_conventions.pod
imcc.l, imcc.y
Leopold Toetsch <lt@toetsch.at>
To install Make, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Make
CPAN shell
perl -MCPAN -e shell install Make
For more information on module installation, please visit the detailed CPAN module installation guide.