C Intermediate Language
OCaml C Perl Makefile Shell Standard ML Other
Latest commit 936b041 Apr 4, 2016 @kerneis kerneis Merge pull request #24 from scolin/scolin-misc-fixes
This pull request solves two minor bugs and a more important one
Permalink
Failed to load latest commit information.
bin Standalone App::Cilly::CilCompiler perl module Oct 28, 2013
doc Execute ocamlbuild only once per make invocation Aug 20, 2013
lib/perl5 Pass compiler options with '=' Aug 18, 2015
m4 Add ability to have size_t on 8 bytes Mar 28, 2016
src Fix a bug where initializations of global variables were not visited Apr 3, 2016
test Fix a bug where initializations of global variables were not visited Apr 3, 2016
.gitattributes Simplify makefile Nov 4, 2011
.gitignore Update .gitignore Sep 12, 2013
.merlin Add findlib to .merlin Aug 26, 2013
.travis.yml Fix Travis CI Mar 28, 2016
CHANGES Move changelog to file CHANGES Jul 24, 2013
LICENSE Minor copyright update Jun 18, 2013
Makefile.in Fix Travis CI Mar 28, 2016
README.md Enable AppVeyor Windows CI Mar 28, 2016
_tags Move ocamlutil to src Aug 27, 2013
aclocal.m4 Use ocaml-autoconf macros Jun 17, 2013
appveyor.yml Enable AppVeyor Windows CI Mar 28, 2016
cil.odocl Rename Features into Feature Aug 26, 2013
config.guess Update config.sub, config.guess and configure.in Jun 17, 2013
config.h.in Avoid warnings about casting pointers to int Sep 20, 2015
config.mk.in Reintroduce bin/ directory and continue cleanup Jun 17, 2013
config.sub Update config.sub, config.guess and configure.in Jun 17, 2013
configure Add ability to have size_t on 8 bytes Mar 28, 2016
configure.ac Avoid warnings about casting pointers to int Sep 20, 2015
install-sh Update install-sh Jun 17, 2013
myocamlbuild.ml Install cmi, cmx and mli for CIL features Sep 4, 2013
opam Fix opam configuration Mar 28, 2016
stamp-h.in Better automatic remaking Jun 17, 2013

README.md

C Intermediate Language (CIL)

Linux Linux build Status Windows Windows build status

CIL is a front-end for the C programming language that facilitates program analysis and transformation. CIL will parse and typecheck a program, and compile it into a simplified subset of C.

CIL supports ANSI C as well as most of the extensions of the GNU C and Microsoft C compilers. A Perl script acts as a drop in replacement for either gcc or Microsoft's cl, and allows merging of the source files in your project. Other features include support for control-flow and points-to analyses.

Quick start

Install the latest release of CIL with opam:

opam install cil

Read the excellent CIL tutorial by Zachary Anderson, and check out the accompanying project template.

Installation

To build and install CIL, you need the OCaml compiler, perl, and ocamlfind. (Of course, you also need some C compiler, preferably gcc.)

Run the following commands to build and install CIL:

./configure
make
make test       # regression test suite, optionnal
make install    # as root or using sudo

If you want to install to some other directory, you can tweak the prefix during the configure step. For instance, to install in your local opam directory:

./configure --prefix=`opam config var prefix`

Usage

You can use cilly (installed in /usr/local/bin by default) as a drop-in replacement for gcc to compile and link your programs.

You can also use CIL as a library to write your own programs. For instance in the OCaml toplevel using findlib:

$ ocaml
        Objective Caml version 4.00.1

# #use "topfind";;
[...]
# #require "cil";;
[...]
# Cil.cilVersion;;           
- : string = "1.7.3"

More documentation

The documentation is located in the doc/html/cil directory. The API documentation (generated by ocamldoc) is in the api subdirectory.

To (re)build the doc, you need Hevea and run:

make doc

You can also browse the documentation online.

Ressources

CIL is maintained by Gabriel Kerneis gabriel@kerneis.info