A lightweight Virtual Machine for dynamic, object-oriented languages.
TODO: Write a project description
$ git clone git://github.com/txus/terrorvm.git $ cd terrorvm $ make
To run the tests:
$ make dev
And to clean the mess:
$ make clean
.tvm bytecode files such as the
hello_world.tvm under the
$ ./bin/vm examples/hello_world.tvm
It ships with a simple compiler written in Ruby (Rubinius) that compiles a
tiny subset of Ruby to
.tvm files. Check out the
compiler directory, which
has its own Readme, and the
compiler/examples where we have the
hello_world.rb file used to produce the
TerrorVM doesn't need Ruby to run; even the example compiler is a proof of concept and could be written in any language (even in C obviously).
TerrorVM tries to implement as much as possible in its own code. You can find a
compiler/examples/prelude.rb, or in native format under
This prelude wires up the VM primitives to the real objects at runtime, so that your code can use them conveniently.
To recompile all examples and kernel files from Ruby to Tvm, do this:
$ make kernel $ make examples
TerrorVM is designed to run dynamic languages. You can easily implement a compiler of your own that compiles your favorite dynamic language down to TVM bytecode.
I've written a demo compiler in Ruby under the
compiler/ folder, just to
show how easy it is to write your own. This demo compiler compiles a subset of
Ruby down to TerrorVM bytecode, so you can easily peek at the source code or
just copy and modify it.
You can write your compiler in whatever language you prefer, of course.
(I rewrote it entirely so I have to write the new format here soon.)
- Hello world (Ruby code, TVM bytecode)
- Maps (Ruby code, TVM code)
- Vectors (Ruby code, TVM code)
- Numbers (Ruby code, TVM code)
- Objects with prototypal inheritance (Ruby code, TVM bytecode)
- Functions and closures (Ruby code, TVM bytecode)
(I have to write the new one here as well.)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request