My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
VirtualMachine  
Intermediate/machine-language interpreter for Kitsch.
Updated Jan 7, 2009 by apangb...@gmail.com

The virtual machine for Kitsch is essentially an interpreter for the Kitsch Compiler's intermediate language output (More details here).

The virtual machine maintains a simple stack and has a hash-table for load/store operations in memory.

Source Code

Source code for the virtual machine can be found here

Running the Virtual Machine

The virtual machine is a simple python script that resides in the /src directory of Kitsch. When make is run, the script is copied to the /bin folder.

$ python bin/vm.py
Usage: python vm.py <input file>
       Use '-' if input file is standard-in

The virtual machine requires an input file to be specified. If you want the VM to interpret input from stdin, specify - as the input file.

If the script is given execute priviledges on a UNIX system, it can be invoked like a shell script or perl script with ./bin/vm.py

$ ./bin/vm.py someProgram.ko

A complete example

This will show how to compile one of the sample source files included with kitsch and to run it with the virtual machine

From the top-level of the kitsch directory...

$ make
$ java -classpath bin Compiler doc/samples/sample2.k doc/samples/sample2.ko
$ ./bin/vm.py doc/samples/sample2.ko
Powered by Google Project Hosting