It is possible to provide KoiViMa with different instruction sets and execution contexts. An example can be found within the directory “src/de/projectory/addingmachine”
There are basically only three things to do:
Create your own execution context. See “AddingContext.java”.
Provide a new set of operators. Look into the “operators/” directory.
Make the new context and instruction set known to the compiler. This is just two lines of code:
compiler.setOperatorsPath( "de/projectory/addingmachine/operators/" ); CodeBlock program = compiler.compileCodeBlock( parser, new AddingContext() );
To run an example program with the new instruction set, type “java de.projectory.addingmachine.Main programs/addingmachine.txt”.
Here is the code of the example:
"Print content of register A" PrintLine 1 MoveA PrintA "Increment register A" PrintLine IncA PrintA "Store A into memory cell 5" PrintLine 5 StoreA "Increment A again" PrintLine IncA PrintA "Get the content of memory cell 5" PrintLine 5 MoveA PrintA