Git Product home page Git Product logo

jeffersonqin / cerberus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rems-project/cerberus

0.0 0.0 0.0 148.57 MB

Cerberus C semantics [used for UPenn CIS 6700 24sp]

Home Page: https://www.cl.cam.ac.uk/~pes20/cerberus/

License: Other

Shell 0.40% JavaScript 0.92% Python 0.14% C 1.42% OCaml 45.93% Standard ML 0.05% Coq 12.38% TypeScript 1.10% CSS 0.22% TeX 0.11% Isabelle 6.65% Makefile 0.29% HTML 30.36% Vim Script 0.01% sed 0.01%

cerberus's Introduction

Cerberus C semantics

CI

Web interfaces, papers, and web page

See https://www.cl.cam.ac.uk/~pes20/cerberus/.

Build instructions for the CLI

To build Cerberus, you need opam (>= 2.0.0, see here to install) and OCaml (>= 4.12.0).

First install the dependencies (including lem and menhir) using opam:

$ opam install --deps-only ./cerberus-lib.opam ./cerberus.opam

Then build the CLI using:

$ make

The CLI can then be used either from the source directory using:

$ dune exec cerberus -- ARG1 .. ARGN

or, after doing $ make install, using the cerberus executable.


To fully remove all object and Lem generated files:

$ make distclean

To remove the object files, but keep the Lem generated files (allowing for faster build when only working on .ml files):

$ make clean

Basic usage

Executing some translation units:

$ cerberus --exec file1.c ... fileN.c

This will elaborate to Core, link, look for a main() function, and start executing the Core from there. To see a printout of the return value, and to get a machine-friendly collection of stdout and stderr, add the --batch argument.

Passing command line arguments to the C program

$ cerberus --args="arg1","arg2" file.c

Printing the intermediate representations

  • The C abstract syntax (Cabs) and the Ail intermediate representation can be printed with --ast=cabs and --ast=ail.

  • The Ail intermediate representation and the Core program can be pretty-printed with --pp=ail and --pp=core.

Running the elaborate-and-link pipeline without executing:

$ cerberus file1.c ... fileN.c

This will elaborate the C translation units to Core programs, and link them, before returning silently.

Include directories can be added with the usual -I, and macros can be forwarded to the preprocessor using -D (and unset with -U).


For more, see cerberus --help


Various C programs can be found in tests/.

Building Cerberus-BMC

Install the common dependencies and the following extra ones:

  • angstrom (0.15.0)
$ opam install angstrom

Then run:

$ make cerberus-bmc

To run:

$ cerberus-bmc --help

Building the web server

Install the common dependencies and the following extra ones:

  • lwt
  • fpath (0.7.3)
  • ezgzip (0.2.3)
  • cohttp-lwt-unix (5.0.0)
$ opam install lwt fpath ezgzip cohttp-lwt-unix

Then:

$ make web

This installs all the available web instances as webcerb.* and the web server cerberus-webserver.

To build the UI, install node package manager npm (sudo apt install nodejs npm ) and:

$ make ui

Edit the generated config.json.

Run:

$ cerberus-server --help

Building the abstract interpreter

Install the common dependencies and the APRON library (tested with v0.9.12).

$ opam install apron

Then:

$ make absint

All targets

You can also compile all the targets with:

$ make all

Building CN

See https://github.com/rems-project/cerberus/blob/master/backend/cn/INSTALL.md

Docker image

$ make -f Makefile_docker

creates a Docker image than can be used for example with:

$ docker run --volume `PWD`:/data/ cerberus:0.1 tests/tcc/00_assignment.c --pp=core

This image contains all the source code.

People

Contributors:

The main Cerberus developer is Kayvan Memarian. Victor Gomes made substantial contributions across the system. Kyndylan Nienhuis worked on the operational semantics for C11 concurrency. Stella Lau is the main developer of Cerberus BMC. The CN backend is by Christopher Pulte and Thomas Sewell. The CHERI memory model is by Vadim Zaliva. Cerberus originated with Justus Matthiesen's 2010-11 Part II project dissertation and his 2011-12 MPhil dissertation. James Lingard's 2013-14 MPhil dissertation developed a certifying translation validator for simple C programs for the Clang front-end, w.r.t. the Cerberus and Vellvm semantics.

Funding

This software was developed largely within the Rigorous Engineering of Mainstream Systems (REMS) project at the University of Cambridge. It has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No 789108, ELVER); the EPSRC Programme Grant REMS: Rigorous Engineering of Mainstream Systems (EP/K008528/1); an EPSRC Leadership Fellowship EP/H005633 (Sewell); a Gates Cambridge Scholarship (Nienhuis); an MIT EECS Graduate Alumni Fellowship (Lau); and Google.

cerberus's People

Contributors

cp526 avatar dc-mak avatar elefthei avatar jeffersonqin avatar kerneis avatar kmemarian avatar kyndylan avatar mackieloeffel avatar metp avatar neel-krishnaswami avatar opqrs avatar petersewell avatar rbanerjee20 avatar ric-almeida avatar rlepigre avatar stellamplau avatar talsewell avatar victorgomes avatar vzaliva avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.