24 lines
992 B
Markdown
24 lines
992 B
Markdown
Commands
|
|
--------
|
|
Gir brainfuck has in addition to the base 8 commands `+-<>[].,` also `:;`
|
|
for printing and reading integers and `#` for triggering a breakpoint. These
|
|
can be turned off by passing a second `false` parameter to `compile()`
|
|
|
|
Tape
|
|
----
|
|
Gir's tape is unbounded in both directions and made out of unsigned 8-bit
|
|
cells that wrap around
|
|
|
|
IO
|
|
--
|
|
`.` and `,` operate on a utf-8 stream. `,` produces `0` by default on EOF.
|
|
This can be changed by passing a third parameter to newVM, where 0/-1 sets
|
|
the cell to that and null keeps it unchanged
|
|
|
|
`:` produces a decimal representation of the current cell. `;` skips any
|
|
space (U+20) characters in the input stream and then reads 1 or more ASCII
|
|
digit (U+30 to U+39), clamps the number to the range [0, 255] and sets the
|
|
cell to it. If it can't read a digit and EOF has been reached it produces an
|
|
EOF similarily to `,` (by default sets to 0, but can be changed), but if EOF
|
|
hasn't been reached it raises an error flag and stops execution
|