Skip to content
A simple stack-based VM
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Remove EQ (fix #232) Jun 12, 2019
gnulib @ 4172747
m4 gen-main: do VM core dump on relevant signals (fix #81) Jun 1, 2019
python Python: simplify and fix State.step() Jun 12, 2019
tests Remove EQ (fix #232) Jun 12, 2019
.gitignore .gitignore: remove /.gitmodules, which is a legit (and checked-in) file! Jun 12, 2019
.sift.conf Sift: configure not to search bibtex or pforth directories May 18, 2019
COPYING Rename from SMite to Mit (fix #149) May 7, 2019 Make it easy to use oprofile (fix #230) Jun 12, 2019 Overhaul optional tests: add “make check-bench” Jun 12, 2019
README Rename from SMite to Mit (fix #149) May 7, 2019
mit.magic Rename from SMite to Mit (fix #149) May 7, 2019


by Reuben Thomas

Mit is a simple virtual machine designed for study and experiment. It uses a byte-stream code designed for efficient execution which is binary portable between implementations. It has been implemented in C for POSIX systems. Mit is designed to be embedded in other programs; Python 3 bindings are provided that demonstrate this ability and provide a convenient REPL and debugger. In the C implementation, all memory references are bounds checked. An I/O library is implemented; access to native code routines is also possible, allowing Mit and C programs to call each other.

This package comprises the definition of the Mit virtual machine and an implementation in ISO C99 using POSIX APIs.

The package is distributed under the MIT/X11 License (see the file COPYING). Note that some files are in the public domain, notably the specification of Mit; they are marked as such.



Mit should work on any POSIX-1.2001-compatible system. Mit has been tested on x86_64 GNU/Linux with GNU C.

Reports on compatibility, whether positive or negative, are welcomed.

Building from a release tarball

Perl and help2man are required to build from source. For building from git, see below.

To build Mit from a release tarball, run

./configure && make && make check

See ./configure --help for build options; note in particular the environment variables ENDISM and WORD_BYTES, and the flag --enable-package-suffix.

For the bibliographies in the documentation to be built correctly, GNU Make should be used.

Building Mit from git

The GNU autotools are required: automake, autoconf and libtool. Gnulib is also used, with a third-party bootstrap module; these are installed automatically.

To build from a Git repository, first run ./bootstrap, then see "Building from source" above.

To build the PDF documentation, a comprehensive TeX system such as TeXLive is required. This is only necessary when building from Git, as pre-built PDFs are supplied in release archives.


Run mit OBJECT-FILE (see mit --help for documentation). To run the shell, mit-shell.


Include mit/mit.h (see this file for its documentation), and link with libmit. In addition, mit/opcodes.h contains an enumeration type of Mit’s instruction set.


The documentation consists of:

  • The Mit Virtual Machine
    The design of the Mit virtual machine is described. Essential reading for those programming or implementing the VM.
  • The comments in mit.h.
  • Comments in the Python modules.
  • contains further information for maintainers.

Mit is based on Beetle, which I developed for my BA dissertation project.


pForth is an ANSI Forth compiler that targets Mit.

Running Mit object files

The C implementation of Mit allows a hash-bang line to be prepended to an object file, so that they can be run directly. A suggested line is:

#!/usr/bin/env mit

A magic file for the file(1) command is also provided: mit.magic.

Bugs and comments

Please send bug reports (preferably as GitHub issues) and comments. I’m especially interested to know of portability bugs.

You can’t perform that action at this time.