This section is a quick reference to PIR instructions. For more details and the latest changes, see imcc/docs/syntax.pod or dive into the source code in imcc/imcc.l and imcc/imcc.y .
Assign a value to a particular register, temporary register, or named variable.
DEST = VAL + VAL DEST += VAL |
Add two numbers or PMCs.
DEST = VAL1 - VAL2 DEST -= VAL1 DEST = - VAL |
Subtract VAL1 from VAL2 . The unary - negates a number.
DEST = VAL * VAL DEST *= VAL |
Multiply two numbers or PMCs.
DEST = VAL1 / VAL2DEST /= VAL1 |
Divide VAL1 by VAL2 .
Raise VAL1 to the power of VAL2 .
DEST = VAL1 % VAL2 DEST %= VAL1 |
Divide VAL1 by VAL2 and return the ( mod ) remainder.
DEST = VAL . VAL DEST .= VAL |
Concatenate two strings. The concat operator must be surrounded by whitespace.
if VAL1 < VAL2 goto LABEL |
Conditionally branch to a label if VAL1 is less than VAL2 .
if VAL1 <= VAL2 goto LABEL |
Conditionally branch to a label if VAL1 is less than or equal to VAL2 .
if VAL1 > VAL2 goto LABEL |
Conditionally branch to a label if VAL1 is greater than VAL2 .
if VAL1 >= VAL2 goto LABEL |
Conditionally branch to a label if VAL1 is greater than or equal to VAL2 .
if VAL1 = = VAL2 goto LABEL |
Conditionally branch to a label if VAL1 is equal to VAL2 .
if VAL1 != VAL2 goto LABEL |
Conditionally branch to a label if VAL1 is not equal to VAL2 .
Logical AND. Return VAL1 if it's false. Otherwise, return VAL2 .
Logical OR. Return VAL1 if it's true. Otherwise, return VAL2 .
Logical XOR. If VAL1 is true and VAL2 is false, return VAL1 . If VAL1 is false and VAL2 is true, return VAL2 . Otherwise, return a false value.
Logical NOT. Return a true value if VAL is false.
DEST = VAL & VAL DEST &= VAL |
Bitwise AND on two values.
DEST = VAL VAL DEST = VAL |
Bitwise OR on two values.
DEST = VAL ~ VAL DEST ~= VAL DEST = ~ VAL |
Bitwise XOR on two values. The unary form is a bitwise NOT on a value.
DEST = VAL1 << VAL2 DEST <<= VAL2 |
Bitwise shift VAL1 left by VAL2 number of bits.
DEST = VAL1 >> VAL2 DEST >>= VAL2 |
Bitwise shift VAL1 right by VAL2 number of bits.
DEST = VAL1 >>> VAL2 DEST >>>= VAL2 |
Logically shift VAL1 right by VAL2 number of bits.
DEST = PMC [ KEY ] PMC [ KEY ] = VAL |
Indexed access to a PMC and indexed assignment to a PMC.
DEST = STRING [ OFFSET ] STRING [ OFFSET ] = VAL
Access a one-character substring on a string, starting at a particular offset, or assign to that substring.
Return the address of a label.
Call the named subroutine (a .sub label).
DEST = global NAME global NAME = VAL |
Access a global variable for read or write.
Jump to the named identifier (label or subroutine name).
If the value or expression evaluates as true, jump to the named identifier.
Unless the value evaluates as true, jump to the named identifier.