All Projects → nlsandler → Nqcc

nlsandler / Nqcc

Licence: mit
A compiler for a tiny (but growing!) subset of C, written in OCaml.

Programming Languages

ocaml
1615 projects

NQCC - a not-quite-C compiler

A compiler for a tiny (but growing!) subset of C, written in OCaml.

Requirements

  • Install OCaml and OPAM
  • Configure OPAM
opam init
  • Install dependencies:
opam install oasis
opam install batteries
opam install ounit # only needed for tests

Usage

  • Build it
make
  • To run it, invoke the nqcc script in the project root
./nqcc /path/to/source.c

The compiled executable will be in the same directory as the source file, and have the same name (e.g. source in the example above).

Tests

ocaml setup.ml -configure --enable-tests # you only need to run this once
make test # run unit tests
./test_examples.sh # compile sample programs

You can also test against this test suite.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].