I am starting to sound like a broken record, but here it goes. If you want a more complete tutorial on writing stack based virtual machines, check "The Elements of Computing Systems" and its accompanying course, http://www.nand2tetris.org/.
The book teaches you to build:
1) A CPU from basic electronics elements
2) An assembler to generate machine code
3) A bytecode VM that can be simulated and an assembler generator from the bytecode
4) A basic programming language that generates bytecode
5) An operating system using that language.
I'm midway through building the Assembler and VM myself :-).
The book teaches you to build:
1) A CPU from basic electronics elements
2) An assembler to generate machine code
3) A bytecode VM that can be simulated and an assembler generator from the bytecode
4) A basic programming language that generates bytecode
5) An operating system using that language.
I'm midway through building the Assembler and VM myself :-).