Documentation ¶
Overview ¶
Package emu provides a generalised virtual machine for executing toy programs that operate solely on integers. It is implemented using a kind of degenerate JIT compilation. Instructions are translated into Go, which is compiled into a plugin, which is then loaded using the plugin package.
This code is not security-hardened in any way. Using this code is a bad idea.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TranslatorFunc ¶
TranslatorFunc translates an input line number and line of code into an implementation (one or more lines of Go) and a set of absolute jump targets (line numbers). A TranslatorFunc should not produce labels; Transpile takes care of inserting necessary labels. However, a TranslatorFunc must implement its own jumps (e.g. `goto l%d`).