Intermediate Language, Phase 4
A subset of C

Header

main()
{ int reg[8];
  float freg[8];
  unsigned char mem[80000];

generated code

}

Code

data movement
reg[q] = *(int*)(mem+p);               // int load
reg[q] = *(int*)(mem+reg[p]);          // indirect int load
reg[q] = integer constant;            // int store
*(int*)(mem+p) = reg[q];               // int save
*(int*)(mem+reg[p]) = reg[q];          // indirect int save

reg[q] = *(float*)(mem+p);               // float load
reg[q] = *(float*)(mem+reg[p]);          // indirect float load
reg[q] = float constant;                // float store
*(float*)(mem+p) = reg[q];               // float save
*(float*)(mem+reg[p]) = reg[q];          // indirect float save

*(mem+reg[p]) = string const;            // string store

reg[p] = reg[q];                         // int copy
freg[p] = freg[q];                       // float copy
*(mem+reg[p]) = *(mem+reg[q]);           // string copy

freg[p] = reg[q];              // int to float
reg[p] = trunc(freg[q]);       // float to int

arithmetic operations
reg[p] += reg[q];              // int add
reg[p] -= reg[q];              // int sub
reg[p] /= reg[q];              // int div
reg[p] *= reg[q];              // int mul
reg[p] %= reg[q];              // int mod
reg[p] = -reg[q];              // int neg

freg[p] += freg[q];              // float add
freg[p] -= freg[q];              // float sub
freg[p] /= freg[q];              // float div
freg[p] *= freg[q];              // float mul
freg[p] = -freg[q];              // float neg

*(mem+reg[p]) += *(mem+reg[q]);  // string add

logical operations
reg[p] = (reg[p] == reg[q]);   // int EQ
reg[p] = (reg[p] < reg[q]);    // int LT

control statements
ident:                         // label
goto ident                     // jmp
if (reg[p]) goto ident         // jmp not zero
if (! reg[p]) goto ident       // jmp zero

input/output operations
cout << reg[p];                // write integer value
cout << freg[p];               // write float value
cout << *(mem + reg[p]);       // write string value
cout << "\n";                  // write newline
cout << integer const;         // write integer constant
cout << float const;           // write float constant
cout << string const;          // write string constant
cin >> reg[p];                 // read integer value
cin >> freg[p];                // read float value
cin >> *(mem + reg[p]);        // read string value

Note: The compiler may output to the object code comments as the compiler writer sees fit.