This is a good question, but I don't think there is going to be a good answer. Parrot's design philosophy really is it's focus on facilitating dynamic language. If you're looking for a VM that has a similar focus on static languages, you may be more interested in JVM or (for slightly more language-agnostic) .NET CLI.
The problem with Parrot for these uses is that the "dynamic" part of the philosophy is taken to the extremes. Even basic control flow between functions is highly dynamic, which adds a certain amount of runtime overhead that is unacceptable for most statically-typed languages. For this and other reasons, it's really not going to be worthwhile to implement most static languages on Parrot. It could be an interesting novelty, and maybe it could be a tool to push the boundaries of Parrot's compile-time optimizations, but it would never reach the performance of a dedicated static-language VM like .NET or JVM. The idea that two VMs could interact together is a nice one but in practice I'm not sure how well it would work. You could try to embed one into the other, but conversions to/from would be costly. Even control flow would get extremely messy when you start to think about things like closures and callbacks. Not to mention some of the more advanced ideas. Consider the case where we pass a Parrot continuation into a function from a static VM, and try to unwind both a call stack and Parrot's dynamic call chain simultaneously. In short, I really like the idea, but conceptually I think there are just too many problems to get passed for such a thing to work in a useful way. --Andrew Whitworth On Thu, Feb 18, 2010 at 4:33 PM, Jon Gentle <[email protected]> wrote: > Hello, > > I have been wondering for a few months now, how useful/appropriate is parrot > for static languages? If it's not, has there ever been any discussion about > a companion vm project? One that would not only be similar in design and > philosophy, but would integrate with parrot and enable static and dynamic > languages to coexist. > > The reason that I ask, is because some years ago, I worked on my own little > project called draak. It was aimed at being a compiler that didn't > understand a particular language, but at runtime would load and parse a > language's lex and parser from a text file and then compile it. I was able > to get all of that to work fairly well, but I never had a good intermediate > representation, instead I just used x86 asm as the output. In recent years, > I have gone back and forth on how to do a good IR, between using parrot, > something like llvm, and rolling my own, but I could never get enough worked > through to make a decision. My question above is spawned from liking the > concept and implementation that has been done so far with parrot, but never > sure if parrot would be good for static languages. While I was thinking > through that, I had some musing that if parrot didn't fit the bill, could > parrot have a companion project that would focus on static languages. That > would allow an entire dynamic/static language ecosystem to exist. > > I apologize if the question has been asked, discussed and answered before. > My google-fu is not as strong as it once was. > > -Jon Gentle > > _______________________________________________ > http://lists.parrot.org/mailman/listinfo/parrot-dev > > _______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
