Monday, May 3, 2010

A statically typed VM?

Trying to wrap my head around this idea... The VM I'm playing around with right now is dynamically typed - but its implementation is statically typed. I started thinking about making a bytecode implementation of Irken itself (rather than a Python-like language).

But I'm not sure it even makes sense to try to write a static VM in a static language, because you'd have to do the equivalent of 'void*' casting everywhere. (Of course, this is what you do when you write a VM in C, but it feels a much more natural thing to do in C 8^).

I was curious to see how OCaml dealt with this issue... and was quite surprised to find a VM written in C.

2 comments:

  1. An interesting idea from the Parrot wikipedia page: different 'types' of registers. For my purposes I might have registers meant to hold immediate data (ints, chars, etc...) and registers for pointer types... Ahhhh.. echoes of the beloved m68k.

    ReplyDelete
  2. The more I think about this, the more I lean in a slightly different direction. I think the best option for self-hosting Irken is to write an LLVM backend. That would give me the ability to do JIT as well, which would be nice for interactive stuff.

    ReplyDelete