zacbrown / simplevm

Simple virtual machine for teaching basic concepts of virtual machine implementation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

=== Basic Information
Author  : Zac Brown
Date    : 11.20.2009
License : BSD License

SimpleVM was written for the purpose of demonstrating some
basic techniques in implementing simple virtual machines.
It stemmed from my time spent in a programming languages course
and the professor asked me to teach a couple classes on basic
virtual machines.

This code isn't intended to be used for production systems however
with some more work, its feasible that it could be used as such. It
has a couple major weaknesses right now, mainly lack of any way to
allocate memory and/or garbage collection with objects as well as
a linear search style for looking up line numbers for jump labels.
These are largely due to lack of time to fix these deficiencies.


=== Caveats
* New lines indicate the end of an operation, you can't have multiple
  operations on the same line, so nothing like "IPUSH 5 IPUSH 5 IADD".
  It would need to be:
           IPUSH 5
           IPUSH 5
           IADD

* Character operations
  * CPUSH doesn't need any quotes or apostrophes surrounding a character.
    ie: "CPUSH c" would push the character 'c' on the stack.
  * Its possible that I'll add char type arithmetic/bitwise operations
    at some later time, but it doesn't really make much sense for now.

* No manual memory management for now so there's no real reason to have the
  LOAD/STOR operations. They'll remain till I've decided they need to go
  for good.

* Array operations
  * No way to modify an array after its created right now.
  * Arrays cannot be nested yet.

About

Simple virtual machine for teaching basic concepts of virtual machine implementation.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 76.6%Language:C 19.3%Language:Assembly 2.8%Language:Makefile 1.4%