[LunarWaveVM](https://six-five-six-four.com/git/reactor/lunar_wave_vm) is a [Lua 5.4](https://www.lua.org/) virtual machine written in Rust. ![A star field with an orange crab-shaped nebula facing a dark purple moon with a bright magenta crescent.](pictures/lunar%20wave%20crab%20nebula.jpeg) `luac5.4 -o - test_vectors/fizz_buzz.lua | cargo run -- --pipe-bytecode` ``` 1 2 3 Fizz 4 5 Buzz 6 Fizz 7 ... 44 45 FizzBuzz 46 47 48 Fizz 49 50 Buzz ``` # Roadmap - [x] Loading simple pre-compiled bytecode programs - [x] Hash tables - [x] Fizzbuzz - [ ] Closures - [ ] Error handling - [ ] Garbage collection - [ ] Long strings - [ ] Using arrays internally for tables - [ ] Compiling Lua source code to bytecode # Benchmark 9x slower than PUC Lua, 90x slower than LuaJIT. Based only on the n-body simulation from the computer language benchmarks, because it's easy to run. ``` time target/release/lunar_wave_vm --script test_vectors/n_body.lua -- 500000; time lua test_vectors/n_body.lua 500000; time luajit test_vectors/n_body.lua 500000; -0.169075164 -0.169096567 [src/main.rs:110] x = [] real 0m10.543s user 0m10.535s sys 0m0.000s -0.169075164 -0.169096567 real 0m1.173s user 0m1.165s sys 0m0.004s -0.169075164 -0.169096567 real 0m0.117s user 0m0.116s sys 0m0.000s ```