Writing a runtime system for Jzero
In a programming language implementation, the runtime system is the code that is included to provide basic functionalities needed for the generated code to run. Generally, the higher level the language is and the greater its distance from the underlying hardware, the larger the runtime system. The Jzero runtime system is as small as possible; it only supports a few internal helper functions such as deref()
and some basic functions for input and output. These functions are written in the implementation language (in our case, Unicon or Java), not the Jzero language. Here is the deref()
method in Unicon:
method deref(reg, od) case reg of { Op.R_ABS: { if od < finstr then return data.word(od) else return code[od] } ...