Virtual machine for scripting
I''m creating a scripting language to control virtual robots. It will be compiled for a virtual machine, and at the moment I have a prototype, a stack machine: It has one stack, one array for variables (only static allocation), one array for instructions(and literal values) and a program counter. I''m wondering if a register based approach would be more efficient, do any of you have any experience with that?
***
For Java games and Java related resources, go to http://www.javaengines.dk
***
Developer journal: Multiplayer RPG dev diary
I wrote a C Compiler/VM with a stack, variable array and instruction linked list. Worked great.
I wouldn't try using registers... what's the point if it's a virtual machine? Plus you've gotta write the compiler to decide when to load registers/etc. I just loaded onto the stack with mine.
Right now I'm using the built-in C# compiler with the .NET framework as a "scripting" language (really it's just runtime compilable pluggable source)... it actually compiles just like normal (but without optimizations).
[edited by - Nypyren on May 11, 2003 11:47:11 PM]
I wouldn't try using registers... what's the point if it's a virtual machine? Plus you've gotta write the compiler to decide when to load registers/etc. I just loaded onto the stack with mine.
Right now I'm using the built-in C# compiler with the .NET framework as a "scripting" language (really it's just runtime compilable pluggable source)... it actually compiles just like normal (but without optimizations).
[edited by - Nypyren on May 11, 2003 11:47:11 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement