|
VirtualMachine
Intermediate/machine-language interpreter for Kitsch.
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 CodeSource code for the virtual machine can be found here Running the Virtual MachineThe 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-inThe 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 exampleThis 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 |