Skip to content
Andrew Johnson edited this page May 21, 2024 · 31 revisions

Fragments are the main data structure in the compiler used to represent output code objects as they are rendered. A Fragment is modelled as a map from Strings to S-Expressions. Fragments are available transparently to the type-system, compiler, AND the programmer. Fragments may be used to model a wide variety of code objects, so the data structure is fundamentally dynamic. Dynamic pattern matching is then used by the rest of the compiler to manipulate these Fragments. Functions that manipulate Fragments are also be exposed to the programmer within the rendering context. This interplay between dynamic and static objects creates the fundamental compilation unit throughout the entire compilation process.

Declaring a Fragment Type

fragment type Reg8  AL  | BL  | CL  | DL  | SIL | DIL | BPL | SPL | R8B | R9B | R10B | R11B | R12B | R13B | R14B | R15B; size Reg8 1;
fragment type Reg16 AX  | BX  | CX  | DX  | SI  | DI  | BP  | SP  | R8W | R9W | R10W | R11W | R12W | R13W | R14W | R15W; size Reg16 2;
fragment type Reg32 EAX | EBX | ECX | EDX | ESI | EDI | EBP | ESP | R8D | R9D | R10D | R11D | R12D | R13D | R14D | R15D; size Reg32 4;
fragment type Reg64 RAX | RBX | RCX | RDX | RSI | RDI | RBP | RSP | R8  | R9  | R10  | R11  | R12  | R13  | R14  | R15;  size Reg64 8;
Clone this wiki locally