That Evil Little Red Guy.
Writing a virtual machine is serious fun. But one thing that you probably shouldn't be doing is designing the virtual machine and the compiler at the same time. You ask why? Well, there is a very good reason why. If its a single person who is doing both the development (coding) and the design of a virtual machine, then that part of your brain which lets you write code (the same part that also lets you sit through CAT) is working along with the part that you are probably using when you are doing much more creative stuff, say, like writing blogs.
Now, whats the problem with more of your brain working at the same time? Well, ask any schizophernic and he will tell you. The reason that you shouldn't do both at the same time is because, when you are designing a virtual machine you are letting your creative side flow, and when its a compiler, its not as much a problem of design as it is a problem of assembly. And doing both requires exteremely different types of mind-sets.
When you are designing a compiler, its like you are building something out of lego-blocks. You have to nitpick it to perfection. Every component has to talk to ever other component properly. That means your interfaces and your data-structures that move from one component to the other must be clearly defined. It is in short a process of pain and paitence. But if you are out to write a compiler, don't fret, because the rewards are surely great. Write one compiler, and you will master almost all programming languages that are out there. When you see the syntax trees flowing, the scopes unfolding, and the recursion proceeding in a cyclic loop generating code, you will attain nirvana. Trust me on that.
And, now about that virtual machine. This is more like solving a challenging math problem. Its not as if you are writing a proof for publication, but just like solving a problem for fun. Its more of a creative endeavour. You have a billion options in design, each one with its own pros and cons. Each design decision affecting the way certain language constructs must be generated. This is not only serious creative thinking, but exteremly worthwhile exercise in critical thinking as well. And this spell should never be interrupted by the part of the brain that actually is incharge of the compiler. When both are working together, you get each part involved in a time-wasting dogfight and sometimes you may even be seen arguing with yourself, raising doubts about your sanity in the minds of others. And those are just the minor irritations.
The major ones, come up when the compiler brain comes to your vm brain and starts arguing about who should handle internal name-resolution or the fact that lexical scopes are handled by renaming rather than having a true runtime sphagetti stack. Or, since the vm tries to be elegeant and minimal, then you can't even have RTTI thats better than C++ inspite of the compiler actually compiling some breed of dynamically typed language. Its like in the movies, when there is an angel to your right and a crazy guy in a red drape on your left with a trident poking you.
The greatest mistake you could do while designing a virtual machine would be to let that evil little red guy win! So, if you are ever writing a virtual machine, don't let that evil little red guy win.