Apparently I don't know Gogs' Markdown dialect

This commit is contained in:
Juhani Krekelä 2018-05-22 19:48:09 +03:00
parent fb50e68e85
commit 3a83ffb366
2 changed files with 55 additions and 30 deletions

61
ir.md
View File

@ -6,35 +6,48 @@ This is produced by `parse`. Each subsection shows the properties the
command object of that type has in IR without offsets command object of that type has in IR without offsets
### add ### add
type | `add` property | value
value | The number to add to current cell ---------|------
type | `add`
value | The number to add to current cell
Generated on `+` and `-` Generated on `+` and `-`
### moveHead ### moveHead
type | `moveHead` property | value
value | The number of steps to move the tape head right ---------|------
type | `add`
type | `moveHead`
value | The number of steps to move the tape head right
Generated on `<` and `>` Generated on `<` and `>`
### writeByte ### writeByte
type | `writeByte` property | value
---------|------
type | `writeByte`
Generated on `.` Generated on `.`
### readByte ### readByte
type | `readByte` property | value
---------|------
type | `readByte`
Generated on `,` Generated on `,`
### loop ### loop
property | value
---------|------
type | `loop` type | `loop`
contents | An array of the commands making up the loop body contents | An array of the commands making up the loop body
Generated on `[`…`]` Generated on `[`…`]`
### clear ### clear
type | `clear` property | value
---------|------
type | `clear`
Not generated by the parser directly, but generated by optimizations Not generated by the parser directly, but generated by optimizations
@ -46,27 +59,39 @@ subsection shows the properties the command object of that type has in IR
with offsets with offsets
### add ### add
type | `add` property | value
value | The number to add to the cell ---------|------
offfset | The location of the cell relative to current tape position type | `add`
value | The number to add to the cell
offfset | The location of the cell relative to current tape position
### moveHead ### moveHead
type | `moveHead` property | value
value | The number of steps to move the tape head right ---------|------
type | `moveHead`
value | The number of steps to move the tape head right
### writeByte ### writeByte
type | `writeByte` property | value
offset | The location of the cell relative to current tape position ---------|------
type | `writeByte`
offset | The location of the cell relative to current tape position
### readByte ### readByte
type | `readByte` property | value
offset | The location of the cell relative to current tape position ---------|------
type | `readByte`
offset | The location of the cell relative to current tape position
### loop ### loop
property | value
-----------|------
type | `loop` type | `loop`
contents | An array of the commands making up the loop body 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 isBalanced | Whether execution of the loop body ends in same cell it started in
### clear ### clear
type | `clear` property | value
offset | The location of the cell relative to current tape position ---------|------
type | `clear`
offset | The location of the cell relative to current tape position

View File

@ -2,10 +2,10 @@ Gir has three optimization passes.
joinAdjacentOps joinAdjacentOps
--------------- ---------------
consumes | commands without offsets * *consumes*: commands without offsets
produces | commands without offsets * *produces*: commands without offsets
unknown commands | passed through unmodified * *unknown commands*: passed through unmodified
acts on | `moveHead`, `add` * *acts on*: `moveHead`, `add`
`joinAdjacentOps` joins adjacent `moveHead`s and `add`s together. Normally `joinAdjacentOps` joins adjacent `moveHead`s and `add`s together. Normally
`parse` joins runs of `<>` or `+-` into one command, but if the runs are `parse` joins runs of `<>` or `+-` into one command, but if the runs are
@ -15,20 +15,20 @@ joins `add`s.
transformClearLoops transformClearLoops
------------------- -------------------
consumes | commands without offsets * *consumes*: commands without offsets
produces | commands without offsets * *produces*: commands without offsets
unknown commands | passed through unmodified * *unknown commands*: passed through unmodified
acts on | `loop` with one command, which is `add 1` or `add -1` * *acts on*: `loop` with one command, which is `add 1` or `add -1`
`transformClearLoops` changes loops of the form `[-]` or `[+]` into a single `transformClearLoops` changes loops of the form `[-]` or `[+]` into a single
`clear` command. `clear` command.
addOffsetProperties addOffsetProperties
------------------- -------------------
consumes | commands without offsets * *consumes*: commands without offsets
produces | commands with offsets * *produces*: commands with offsets
unknown commands | raise UnknownIRError * *unknown commands*: raise UnknownIRError
acts on | `moveHead`, `add`, `clear`, `writeByte`, `readByte`, `loop` * *acts on*: `moveHead`, `add`, `clear`, `writeByte`, `readByte`, `loop`
`addOffsetProperties` adds an `offset` property to `add`, `clear`, `addOffsetProperties` adds an `offset` property to `add`, `clear`,
`writeByte`, and `readByte`. The `offset` tells the offset at which from the `writeByte`, and `readByte`. The `offset` tells the offset at which from the