2024-10-28 05:57:00
github.com
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.
Install the latest release of goblint-cil
with opam:
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.
Prerequisites:
First create a local opam switch and install all dependencies:
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
To run a single test go to the build directory (e.g. _build/default/test
) and run e.g.:
dune exec -- make test/array1
You can also install goblint-cil
into the opam switch:
dune build @install
dune install
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.4"
goblint-cil
is licensed under the BSD license. See LICENSE.
Support Techcratic
If you find value in Techcratic’s insights and articles, consider supporting us with Bitcoin. Your support helps me, as a solo operator, continue delivering high-quality content while managing all the technical aspects, from server maintenance to blog writing, future updates, and improvements. Support Innovation! Thank you.
Bitcoin Address:
bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge
Please verify this address before sending funds.
Bitcoin QR Code
Simply scan the QR code below to support Techcratic.
Please read the Privacy and Security Disclaimer on how Techcratic handles your support.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.