7 ms·
Ask HN: What's a good tutorial for writing a stack-based virtual machine?
Eventually I'd like to write my own language like Lua (but stack-based), mostly for fun and partly for practice. But I don't fully understand a lot of aspects of how a virtual machine like that works. Can you recommend a good tutorial on it? Thanks!
- jacquesm 11y agoDo a small Forth implementation. Shouldn't take you more than a few days and you'll learn a ton about stack machines VM or otherwise. Brodie's 'Staring Forth' would be a good point to branch out from. It's fun and it will maybe give you a new perspective on programming.
- sgrossman 11y agoI remember this lecture being useful when I was writing a stack machine for my compilers course: https://class.coursera.org/compilers/lecture/62 https://class.coursera.org/compilers/lecture/62
- pinewurst 11y agoThere used to be one as part of the ANTLR Advanced Tutorial. I used that to bootstrap a fairly complex expert systems shell used as the core of a few things.