Skip to content(if available)orjump to list(if available)

A Fast Bytecode VM for Arithmetic: The Virtual Machine

zackmorris

I did a quick search for "smallest C virtual machine" and found this 16 opcode implementation in 125 lines of C:

https://www.andreinc.net/2021/12/01/writing-a-simple-vm-in-l...

Discussion:

https://news.ycombinator.com/item?id=29492183

I'm looking for small VMs like this to run sandboxed experiments and test just-in-time (JIT) compilers so that I can explore things like converting abstract syntax trees (AST) between languages and prefix/infix/postfix notation, if anyone has any favorites.

Bonus points for supporting advanced concepts like atomic operations for concurrency.

jasonjmcghee

I just want to drop a note that the style / layout etc. of this is really doing it for me.

Reminds me of the web layout of https://craftinginterpreters.com/a-virtual-machine.html