This document describes NAM, aka CgOp, the Niecza Abstract Machine. It is a language used to connect the portable parts of Niecza to the unportable, and as such requires a fairly strong definition. Unfortunately this document is rather incomplete.
NAM code consists of one or more units. Each unit contains a set of fixups (details TBD) which allow compiled code to find metaobject data, and a set of compilable function bodies. One unit shall contain a body named MAIN, which is run to start execution.
A body contains some basic metadata such as the number of lexical slots required, and also a tree of operations. This tree is structured much like a Lisp program and obeys similar evaluation rules. One difference is that NAM nodes have two kinds of children, scalar children and node children, which are treated separately.
A native integer, suitable for loop variables and similar purposes.
A native float, suitable for the Perl 6 Num class.
A native bool, as returned by comparison operators.
A reference to a native immutable string.
A reference to a native mutable string.
A Perl 6 variable, with identity, potentially mutable and tied.
A reference to a Perl 6 object; not a variable and cannot be assigned to.
A hash table mapping strings to Perl 6 variables.
An array of Perl 6 variables fixed in length at creation.
An array of Perl 6 variables supporting O(1) deque operations.
The nexus of HOW, WHAT, WHO, and REPR. Details subject to flux.
A reference to a native text input object.
A reference to a native text output object.
A node in the LTM Automaton Descriptor metaobject tree.
A reference to a compiled character class.
A reference to a low-level cursor. Currently a subtype of obj.
A reference to a call frame. Currently a subtype of obj.
These are for user code only. Core library code should define custom system primitives instead.