Basics
IMCC’s main purpose is assembling PASM or PIR source files. It can run them immediately or generate a Parrot bytecode file for running later.
Internally, IMCC works a little differently with PASM and PIR source code, so each has different restrictions. The default is to run in a “mixed” mode that allows PASM code to mix with the higher-level syntax unique to PIR.
A file with a .pasm
extension is treated as pure PASM code,
as is any file run with the -a
command-line
option. These files can use macros,[45] but none of PIR’s syntax. This mode is
mainly used for running pure PASM tests that were originally written
for assemble.pl
.
The documentation that comes with IMCC
in languages/imcc/docs/
and the test suite in
languages/imcc/t
are good starting points for
digging deeper into its syntax and functionality.
Statements
The syntax of statements in PIR is much more flexible than PASM. All PASM opcodes are valid PIR code, so the basic syntax is still an opcode followed by its arguments:
print "He's pining for the fjords.\n"
The statement delimiter is a newline \n
, just like
PASM, so each statement has to be on its own line. Any statement can
start with a label.
LABEL: print I1
But unlike PASM, PIR has some higher-level constructs, including symbol operators:
I1 = 5
named variables:
count = 5
and complex statements built from multiple keywords and symbol operators:
if I1 <= 5 goto LABEL
We’ll get into these in more detail as we go.
Comments
Comments
are marked by a hash sign (#
). Commented ...
Get Perl 6 Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.