• entries
    437
  • comments
    1000
  • views
    335826

VMs

Sign in to follow this  

279 views

I've been looking more into shared virtual machines for use as a basis of a 'new' GameMonkey-like toy project.

Two are standing out so far; the LLVM and the ParrotVM. LLVM stands out due to it's low-level nature and JIT capabilities whereas Parrot is higher level and was specifically design for working with dynamic languages.

There's two possibilities in targetting another VM other than the custom VM that GameMonkey has at the moment. The first is taking GameMonkey Bytecode produced by the existing compiler and then converting it for use on either LLVM or Parrot (or even MSIL in the case of the C# version). This would be interesting and I'd need to get my head around how it'd actually work in practice. One amusing possibility of this would be converting GM ASM to Lua ASM and allow people to run GameMonkey Script on the Lua machine.

The second option is to rip out the existing compiler and compile GM script into the bytecode native to the VM we're using. I think that this would require reimplementing most of the compiler and virtual machine runtime for GameMonkey, but appears to be the most obvious approach as it involves skipping a step.

I think I've worked out what I want to focus on, that's completing my C# version of GameMonkey which I can then modify to add in new features/functionality as I want. The rationale being that the C# version is my interpretation
of the VM/language so
I know it intimately. It'll also be simpler than the C++ version as I don't worry about breaking the rest of machine when I'm tinkering. This is, afterall, an experiment and having something that doesn't work for long periods of time will be demoralising :)

The next steps in the C# version are as follows:

* Implement a compiler (Lexer is done, Parser still to do, Code Generator still to do)
* Implement the rest of the Standard GameMonkey library functions
* Fix Blocks/Signals
* Implement attribute-based binding for .NET objects
* Optimise the machine
* Examine the possibility of emitting MSIL (way in the future)

There's still a fair bit to do!

The compiler I'll be writing will be hand-crafted. The main reason here is that I want to get into hand parsing an exisint grammar. As Flex and Yacc don't work on .NET and the fact that GOLD is irritating to use has pushed me towards hand crafting the parser. Irony looked good, but ultimatley I'd like to have the experience of writing a parser/AST myself.


In other news, I'm going to the Develop Conference next week. There's some great things on and I'll be writing up a load of it for Gamedev.net in the following weeks. It should be good :)
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now