Muq has a special class of objects called "assemblers" which
are responsible for most of the busywork involved in
actually producing a compiledFunction
. They ensure
that only valid compiledFunction
s are produced --
that is, ones that at minimum will not crash the bytecode
interpreter -- and take care of a great deal of low level
work such as selecting appropriate bytecode encodings,
choosing between one and two byte jump offsets, and similar
arcana of the bytecode instruction set.
Thanks to the assembler, most Muq compiler writers need not even know which instructions are bytecoded on Muq and which are implemented in-db, for the most part, much less the details of (say) conditional branch encoding.
The next few sections concentrate on the mechanics of
generating valid Muq compiledFunction
objects via
assemblers, postponing consideration of how the compiler
gets hooked up to it all: We simply demonstrate simple
programs which generate simple compiledFunction
s.
Go to the first, previous, next, last section, table of contents.