73 lines
1.6 KiB
Markdown
73 lines
1.6 KiB
Markdown
|
Gir uses two types of IR, with and without offsets
|
||
|
|
||
|
Without offsets
|
||
|
---------------
|
||
|
This is produced by `parse`. Each subsection shows the properties the
|
||
|
command object of that type has in IR without offsets
|
||
|
|
||
|
### add
|
||
|
type | `add`
|
||
|
value | The number to add to current cell
|
||
|
|
||
|
Generated on `+` and `-`
|
||
|
|
||
|
### moveHead
|
||
|
type | `moveHead`
|
||
|
value | The number of steps to move the tape head right
|
||
|
|
||
|
Generated on `<` and `>`
|
||
|
|
||
|
### writeByte
|
||
|
type | `writeByte`
|
||
|
|
||
|
Generated on `.`
|
||
|
|
||
|
### readByte
|
||
|
type | `readByte`
|
||
|
|
||
|
Generated on `,`
|
||
|
|
||
|
### loop
|
||
|
type | `loop`
|
||
|
contents | An array of the commands making up the loop body
|
||
|
|
||
|
Generated on `[`…`]`
|
||
|
|
||
|
### clear
|
||
|
type | `clear`
|
||
|
|
||
|
Not generated by the parser directly, but generated by optimizations
|
||
|
|
||
|
|
||
|
With offsets
|
||
|
------------
|
||
|
This is produced by the optimization pass `addOffsetProperties`. Each
|
||
|
subsection shows the properties the command object of that type has in IR
|
||
|
with offsets
|
||
|
|
||
|
### add
|
||
|
type | `add`
|
||
|
value | The number to add to the cell
|
||
|
offfset | The location of the cell relative to current tape position
|
||
|
|
||
|
### moveHead
|
||
|
type | `moveHead`
|
||
|
value | The number of steps to move the tape head right
|
||
|
|
||
|
### writeByte
|
||
|
type | `writeByte`
|
||
|
offset | The location of the cell relative to current tape position
|
||
|
|
||
|
### readByte
|
||
|
type | `readByte`
|
||
|
offset | The location of the cell relative to current tape position
|
||
|
|
||
|
### loop
|
||
|
type | `loop`
|
||
|
contents | An array of the commands making up the loop body
|
||
|
isBalanced | Whether execution of the loop body ends in same cell it started in
|
||
|
|
||
|
### clear
|
||
|
type | `clear`
|
||
|
offset | The location of the cell relative to current tape position
|