Skip to content


Subversion checkout URL

You can clone with
Download ZIP
An x86 machine-code toolkit
Scheme C Python C++
Latest commit 28a51c9 darius changed website


        Miasma: an x86 machine code toolkit
        Version 0.3

        By Darius Bacon <>
        and Brian Spilsbury <>.
        Distributed under the GNU Lesser General Public License; 
        see the accompanying COPYING file for details.


To run, enter (load "loadme.scm") after editing that file to use the
portability-foo.scm appropriate to your Scheme system.  Then enter
(generate-c-assembler "c/asm.h") to generate an asm.h file.  c/calc.c
is a trivial sample jit compiler using it.  That, and the Python
equivalent below, are all there is that's usable in this version (and
not very, at that).  See Miasma 0.1 for a version that has seen some
actual use.

Similarly, you can regenerate the Python code emitter with
(generate-py-assembler "python/").  To use it, cd into the
python subdirectory, run `make', then `python' or `python "2 3 +"'. builds and calls a trivial function that
adds 42 to its argument. compiles an RPN expression, then
calls the compiled code.


Miasma is a Scheme program that generates x86 machine code generators.
Its intended uses include compiler backends and runtime code
generation, and perhaps in the future other machine-code toolkit
functions like disassembly.

Version 0.1 was torn bodily out of Vapour
(  0.2 was redesigned to make it easier
to generate code for different purposes from the instruction tables,
e.g. backends in different languages -- though so far all I've done is
a C backend.  Scheme and Common Lisp backends should be easy to put
back in but I haven't had a need for one yet.  0.3 adds a Python


This version is undocumented.  These docs were for 0.1 but should
still shed some light:

        old/doc/Usage.text      The assembler syntax
        old/doc/Overview.text   How the implementation works


Miasma x86 machine code toolkit
Copyright (C) 2000,2002  Darius Bacon and Brian Spilsbury

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
Something went wrong with that request. Please try again.