
Build Your Own Programming Language
By :

This section describes a simple file format and instruction set for Jzero code, generated from three-address intermediate code. For the language that you create, you might use a subset of the Java bytecode instruction set instead. Java bytecode is a complicated format; if it wasn't, we wouldn't be going to the trouble of presenting something simpler. The instruction set presented here is slightly more capable than Jzero uses, to allow for common extensions.
The Jzero format consists of a header, followed by a data section, followed by a sequence of instructions. Jzero files are interpreted as a sequence of 8-byte words in little-endian format. The header consists of an optional self-execution script, a magic word, a version number, and the word offset of the first instruction, relative to the magic word. A self-execution script is a set of commands written in some platform-dependent...