Alchemist
2010-12-11
Introduction
Alchemist is a code generation library that can be used to programmatically generate machine code. An example scenario in which this can be useful is in the implementation of programming language interpreters. The user types an expression, which is then compiled to machine code and subsequently evaluated.
License
Alchemist is licensed under the LGPL version 2.1. Roughly (but see the license itself for details), this means that:
- You are free to link any program, including proprietary software, to Alchemist, and this does not impose any restrictions on that program.
- If you distribute a modified version of Alchemist, you must also provide the source code to your changes.
Status
Alchemist is currently in an early stage of development. Multiple target CPUs are eventually planned, but, currently, there is only partial support for x86 (16-bit and 32-bit). Having said that, the API for generating x86 machine code seems to have stabilized, so now it's just a matter of adding instructions to get usable x86 support.
Download
Alchemist is hosted on repo.or.cz public Git hosting. All source code is available via the project page. Some useful links:
- The Git URL for Alchemist is git://repo.or.cz/alchemist.git
- You can download latest development snapshot as a tarball.
Examples
The example below uses Alchemist to generate the x86
machine code for performing an exit(42)
system call on Linux.