"Mistakes are the portal of discovery" --James Joyce

simpleb

Last updated 22nd Aug 2007

Simpleb is a compiler for a subset of C. It is programmed in ocaml and supports loops and conditionals. However, it does not support arrays, pointers or functions. It is possible to call external functions (e.g. printf).

The parser and grammar are created using ocamllex and ocamlyacc.

The compiler only converts the source code into assembly. An assembler (e.g. nasm) is then required to compile the assembly code into an object file. Finally a linker (e.g. gcc or ld) is required to link the object files into a binary application.

Downloads

Using the compiler

on gentoo linux
emerge dev-lan/nasm
emerge dev-lang/ocaml
tar xvfz simpleb.tar.gz
cd simpleb
make
make filename.sim
./samples/filename.out