I’m going to try to write a compiler for a dynamic language. Preferably to some existing virtual machine — I don’t (yet) want to deal with garbage collection and the myriad other concerns a good VM handles for you. What VMs do you suggest?
I’m on Linux, so I don’t know if .NET (via Mono) is that good an idea. I’ve heard that Parrot is good for dynamic languages, but I haven’t heard of any language use that. Should I invent my own? Does LLVM even count as a VM I should compile against, or is it as hard as straight x86?
Also, what pros and cons are there to stack-based vs register-based VMs?
Performance and tool support would be important. I’ll be writing the compiler in Haskell, so a good interface with that is a plus.
JVM (Java) and the CLR (.NET) seem to be the two most common targets for this, as they both handle most of these issues for you. Both provide fairly straightforward instruction sets to work with.
The CLR has one advantage – it was really designed with the goal of supporting multiple languages from the start, and it’s (IMO) slightly easier to work with, especially if you’re not going to be writing a language that fits into the original “mold” of the initial languages targeting that runtime. Mono works well enough that I wouldn’t shy away from a CLR target because of it.