Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 2.13 KB

README.md

File metadata and controls

22 lines (18 loc) · 2.13 KB

fun

A collection of scripts and mini-projects, hopefully a few will become something meaningful. See the rundown section for a description of what's in this repo, and some projects may have their own Replit that one can fork and experiment with. To run something locally, see the dependencies section. Everything here is licensed under the MIT License.

rundown:

  • autodiff.scm is a short automatic differentiation library with a repl. Its whole thing is being able to evaluate derivatives at a point, but the derivatives it prints out are in s-exps and can't be further manipulated. To get started, once in the program's repl, run the :h command. Replit
  • mips-programs is currently just one mips program (mergesort), because I can't share the other one as it was a class assignment. I use them to test the mips vm.
  • mips-c-vm is a virtual machine for a subset of MIPS. A usage example is in the Makefile (in the folder, make mergesort). It can run programs that write to a 256x512 display that starts at the address where .data starts: 0x10010000. Currently, the display is only functional on non-nix compilations, so one needs to install SDL2 normally.

dependencies:

  • autodiff.scm is R5RS compliant except for its use of #!eof. I run it with Chicken Scheme, which is what my replit for it uses as well. Gambit is also a fantastic option, and it has a web version, though it makes the autodiff repl look weird, so it needs the following patch:
;; Patch for running on try.gambitscheme.org
;; Replace the readrepl function with this one.
(define (readrepl)
  (display ">> ")
  (flush-output-port) ; flush port to make sure the prompt is displayed
  (read))
  • mips-programs just needs Mars
  • mips-c-vm The VM itself needs gcc, pkg-config, and SDL2. The whole experience requires Chicken Scheme (for the joke of an assembler) and Mars as well. Chibi Scheme also works.