An implementation of the Human Resource Machine programming language by Tomorrow Corporation.
Prerequisites:
- Java Runtime Environment 1.7 or newer
- optional Human Resource Machine Soundtrack playing in the background
Download the zip (Windows) or tgz (Linux) file from Bintray, extract it and call the start script in the bin
directory, e. g. HRMReproductionMechanism YourSource.hrm
.
You can also execute the interpreter directly from source: gradlew run -Pargs=YourSource.hrm
.
INBOX
reads the next hand value from stdinOUTBOX
writes the current hand value to stdoutCOPYFROM #ADDR
reads a hand value from the given floor tileCOPYTO #ADDR
stores the current hand value in the given floor tileADD #ADDR
adds the given floor tile's value to the current hand valueSUB #ADDR
subtracts the given floor tile's value from the current hand valueBUMPUP #ADDR
increses the given floor tile's value by oneBUMPDN #ADDR
decreses the given floor tile's value by one#LABEL:
defines a label you can jump toJUMP #LABEL
continues execution at the given labelJUMPZ #LABEL
continues execution at the given label only if the current hand value is zeroJUMPN #LABEL
continues execution at the given label only if the current hand value is negative--
orCOMMENT
mark the beginning of a new comment line- An address
#ADDR
may be specified either directly as a#NUMBER
or indirectly via[#NUMBER]
, in which case the value of floor tile#NUMBER
will be used as address.
- As replacement for the graphical representation of jump targets you can declare labels and use those to designate a jump's destination.
- Binary content e.g. comments and custom floor tile names are ignored.
- Lots of tiles are available on the floor, per default there are 9000.
- You can enable literal mode with
-Dliteral=true
, which preinitializes all floor tiles with their their index. This allows you toCOPYFROM 23
to get 23 into your hands, as long as you haven't put anything on tile 23. - The instruction
DUMP
will print debugging information.
Implemented:
- ANTLRv4 based parser
- direct interpreter
- nice stack trace in case of error
TODO:
- optimizations
- compiler
- marketing brochures