Github: https://github.com/Tom-Willemsen/splbytecode
splbytecode is a shakespeare programming language compiler targeting the JVM.
Given the following simple program in shakespeare programming language:
A simple example demonstrating getting numeric input, adding one to it, and printing the result.
Romeo, a goat.
Juliet, a lady.
Act I: Getting incrementally closer.
Scene I: The one and only scene.
[Enter Romeo and Juliet]
Romeo: Listen to your heart!
Romeo: You are thyself and a cat!
Romeo: Open your heart!
[Exeunt]
splbytecode can compile it into a java class which outputs the following:
> python compiler.py examples/incrementor.spl
> java SplProgram 12321
12322
The compiler is capable of producing class files which:
- Read from
stdin
- Output to
stdout
- Hold state in a finite number of “characters”
- Perform absolute assignments, increments and decrements on any “character”
- Perform conditional jumps
However, several of the more advanced features of the shakespeare programming language are not implemented:
- Allowing each character to have a “stack” of values as opposed to a single value
- Complex arithmetic arithmetic operations (e.g. You are the quotient of … and …)
- Turning on/off variable initializers (The spec says the text after a variable declaration is ignored, but other compilers try to interpret it as a value)