gir/brainfuck.md

24 lines
992 B
Markdown
Raw Permalink Normal View History

2018-05-22 16:39:48 +00:00
Commands
--------
2018-05-26 10:14:05 +00:00
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()`
2018-05-22 16:39:48 +00:00
Tape
----
Gir's tape is unbounded in both directions and made out of unsigned 8-bit
cells that wrap around
IO
--
2018-05-27 09:56:02 +00:00
`.` 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
2018-05-26 10:14:05 +00:00
`:` 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
2018-05-27 09:56:02 +00:00
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