Hey everyone! I'm diving into the world of virtual machines, specifically stack-based and register-based types. My goal is to build one from the ground up because I'm really interested in how languages like Java function. I'm not aiming for anything groundbreaking, but I'm keen to understand the mechanics behind language design—like why certain languages are structured in specific ways and which ones are optimized for portability, much like Java. So, I'm looking to learn about various virtual machine types, especially the stack-based and register-based approaches. Any advice on where to start?
4 Answers
I’d suggest doing a bit of research first to formulate more specific questions. Just asking 'how do I start?' can be too broad. If you're still stuck, talking to an AI like ChatGPT could help!
If you're into designing programming languages, I recommend starting with a simple Lisp. It could be your foundation for everything else. Check out the book 'Structure and Interpretation of Computer Programs' for a deeper dive.
Thanks for the recommendation! I’ll definitely give it a read.
Definitely look into WebAssembly (WASM) if you want to broaden your understanding of virtual machines.
I’ll check that out! Thanks for the suggestion!
I found some great resources online for building VMs, like courses and tutorials. Here are a few:
- https://www.udemy.com/course/virtual-machine/
- https://www.jmeiners.com/lc3-vm/
- https://craftinginterpreters.com/a-virtual-machine.html
- https://dmitrysoshnikov.teachable.com/p/virtual-machine
- https://www.andreinc.net/2021/12/01/writing-a-simple-vm-in-less-than-125-lines-of-c
- https://dev.to/bosley/building-a-virtual-machine-3ocj
- https://blog.subnetzero.io/post/building-language-vm-part-00/
I appreciate it! I did some digging, but I think a conversation would be more helpful for me. Thanks, though!