goblint-cil

A front-end for the C programming language that facilitates program analysis and transformation
README

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.

goblint-cil is a fork of CIL that supports C99, C11 as well as most of the
extensions of the GNU C. It makes many changes to the original CIL in an effort
to modernize it and keep up with the latest versions of the C language. Here is
an incomplete list of some of the ways goblint-cil improves upon CIL:

  • Support for C99 and C11.

  • Compatibility with modern OCaml versions.

  • Use Zarith instead of Num and use that for integer constants.

  • Improved locations with columns and spans.

  • Removal of unmaintained extensions and MSVC support.

  • Use dune instead of make and ocamlbuild.

  • Many bug fixes.

Quickstart

Install the latest release of goblint-cil with opam:

opam install goblint-cil

Read the excellent CIL tutorial by Zachary Anderson, much of which
still applies to goblint-cil. The repository referenced in that document has now moved here.

ATTENTION: Don't install the cil package. This is the unmaintained
original version of CIL.

Installation from Source

Prerequisites:

  • opam

  • GCC

  • Perl

First create a local opam switch and install all dependencies:

opam switch create .

Then, you can use dune to build goblint-cil. Run the following
commands to build and test goblint-cil:

dune build
dune runtest    # runs the regression test suite

You can also install goblint-cil into the opam switch:

dune build @install
dune install

Usage

You can use cilly (installed in the opam switch) as a drop-in
replacement for gcc to compile and link your programs.

You can also use goblint-cil as a library to write your own programs. For
instance in the OCaml toplevel using Findlib:

$ ocaml
OCaml version 4.14.0

# #use "topfind";;
[...]
# #require "goblint-cil";;
[...]
# GoblintCil.cilVersion;;
- : string = "2.0.0"

License

goblint-cil is licensed under the BSD license. See LICENSE.

Install
Published
17 Aug 2022
Sources
goblint-cil-2.0.0.tbz
sha256=0467f30218c7ef03074b96912e46f58883e5229ba7d30102470191ad39a49b26
sha512=08a7a1a79dce32072431dd681866682e9dab7acbc4cb6e0e2255d6b71fea7020d7fcf00bbbb130489b77f03fa244382dce30eca67d75967e81b06e09996d44a8
Dependencies
Reverse Dependencies
goblint
>= "2.0.0" & < "2.1.0"