An optimizing brainfuck interpreter in js
Go to file
Juhani Krekelä 31d5bbbdeb Only transform list of lines into string at end of prettifyIR, since otherwise we concat an array with a string 2018-05-24 23:05:59 +03:00
.gitignore First commit 2018-05-21 23:55:48 +03:00
README.md Update README.md 2018-05-24 11:20:33 +03:00
UNLICENSE First commit 2018-05-21 23:55:48 +03:00
brainfuck.md Add documentation 2018-05-22 19:39:48 +03:00
gir.html First commit 2018-05-21 23:55:48 +03:00
gir.js Only transform list of lines into string at end of prettifyIR, since otherwise we concat an array with a string 2018-05-24 23:05:59 +03:00
ir.md Add flattenLoops pass 2018-05-23 21:48:35 +03:00
optimizations.md joinAdjacentOps should recurse 2018-05-24 22:50:31 +03:00

README.md

Gir is an optimizing brainfuck interpreter in Javascript.

Name

𒌋𒀜 gir (Sumerian) - n. kiln

License

Everything in the repo is under Unlicense / CC0.

Status

Gir can parse, prettyprint, and run programs in brainfuck. Gir supports following optimizations:

  • Turn runs of +- or <> into one command
  • Turn [-] or [+] into one command
  • Add offsets to commands that modify tape, to reduce moving tape head

TODO

gir.js

  • Implement :;#
  • Optimization pass to turn multiply loops into commands that do x += y * c
  • Make VM use a Proxied object that gives out 0 for nonexistent elements for its memory
  • Implement UTF-8 I/O
  • Allow cycle maximum to be passed to run()
  • Keep a cache of compiled programs in run()

gir.html

  • Implement a UI

Documentation

  • Document the VM
  • Document the user-facing API
  • Document the overall architecture

General

  • Get this on NPM?