This is my implementation of bytecode VM for Lox language in Haskell. It can be thought of as a follow-up to my PyLox project. There are two things I wanted to achieve with this project:
- Get some practice with Haskell, which I like a lot, and
- Build a bytecode VM for Lox in Haskell (since the other four Haskell implementations all seem to be tree-walking interpreters).
Section 22.4.1 is completed. Meaning, we have locals, but not the weird edge case with var a = a. To-do list:
- Complete code translation from C to Haskell
- Replace the
Stringtype with strictTextwhere necessary - Simplify structures and functions where possible (including removing
IO) - Decide whether to use
Vectors orArrays - Switch to lenses instead of manually changing structures
- Refactor the
Compilermodule to be less imperative - Clean up imports and code style in general
- Optimize for speed and memory (to the best of my ability)
- Resolve other TODO markings
- If there are problems with strings: take additional measures regarding
unsafeIORef - Optionally, annotate what is going on and which function in my code is analogous to which in the original clox (to add a bit of educational value)