/lazy-tis-100

Simulator and maybe code synthesis for TIS-100 cpu

Primary LanguageHaskellMIT LicenseMIT

lazy-tis100

This is lazy!

  1. Haskell: It is written in Haskell because I'm lazy. Also, Haskell uses lazy evaluation.
  2. Lazy Evaluation of Nodes: It won't compute nodes unless it has too: Nobody wants to read a value from that node? Who cares whether it would have produced one.
  3. Lazy Evaluation of Values: It won't commit on values unless it has to: What's the value in this register? Let's call it x1 until some jump depends on it.
  4. Program Synthesis: Assembly is hard! Can't the computer do it for us? Well... maybe?

Notes for myself

Haskell on Debian in VM on Apple M1:

This may also be useful:

  • nix-shell -p autoPatchelfHook numactl ncurses5 ncurses gmp --run "autoPatchelf /home/parallels/.stack/programs/"
  • stack exec -- ghcid -c="stack ghci src/Lib.hs test/Spec.hs" -T="main" --warnings $@ --reload src
  • stack ghci src/Lib.hs test/Tests/ASpec.hs src/LazyTIS100/Parser.hs --ghci-options -XOverloadedStrings

Using x86-64 GHC on M1 (with Debian):

  • sudo dpkg --add-architecture amd64
  • sudo apt update
  • sudo apt install libc6:amd64 libgmp-dev:amd64 libncurses5:amd64