seL4-L4.verified/tools/c-parser
Gerwin Klein 1c26e288c8 c-parser: update to Isabelle2025
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2025-06-13 13:20:24 +10:00
..
Simpl Simpl: add changes from afp-2025 2025-06-13 13:20:24 +10:00
doc license: provide documentation under CC-BY-SA-4.0 2020-03-16 14:19:15 +08:00
recursive_records isabelle2021-1: remove extend from TheoryData 2022-03-29 08:38:25 +11:00
standalone-parser c-parser: update to Isabelle2025 2025-06-13 13:20:24 +10:00
testfiles c-parser: update to Isabelle2025 2025-06-13 13:20:24 +10:00
tools spdx: provide copyright info for mllex/mlyacc 2020-03-16 14:19:15 +08:00
umm_heap lib+asmrefine+autocorres+c-parser+proof: update to Isabelle2024 2024-06-12 13:25:18 +10:00
.gitignore c-parser: provide AARCH64 setup 2022-02-03 16:13:45 +11:00
Absyn-CType.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Absyn-Expr.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Absyn-Serial.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Absyn-StmtDecl.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Absyn.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Binaryset.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
CLanguage.thy licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
CProof.thy c-parser+crefine+clib: move is_aligned_c_guard to c-parser session 2023-01-12 11:48:59 +10:30
CTranslation.thy lib+tools: MLUtils -> ML_Utils for consistency 2023-01-20 13:43:39 +11:00
Feedback.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
FunctionalRecordUpdate.ML c-parser: rewrite functional-record-update fN defs 2021-03-05 18:32:43 +11:00
General.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
HPInter.ML c-parser + autocorres: Simpl update 2024-03-15 09:30:46 +01:00
INSTALL.md c-parser: bump Isabelle version in docs 2023-11-03 14:00:01 +11:00
IndirectCalls.thy licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
LemmaBucket_C.thy lib+proof+tools: move LemmaBucket_C into CParser 2023-01-25 10:18:11 +11:00
MANIFEST Finish serialisation code for AST. 2016-07-05 17:37:14 +10:00
MString.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Makefile c-parser: fail in Makefile if L4V_ARCH is not set 2025-06-13 13:20:24 +10:00
MemoryModelExtras-sig.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
MemoryModelExtras.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
ModifiesProofs.thy licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
PackedTypes.thy isabelle-2021 cparser: Word_Lib include 2021-09-30 16:53:17 +10:00
PrettyProgs.thy licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
README.md c-parser: update change log and readme for release 2024-10-11 09:41:36 +11:00
RELEASES.md c-parser: update change log and readme for release 2024-10-11 09:41:36 +11:00
ROOT lib+proof+tools: move LemmaBucket_C into CParser 2023-01-25 10:18:11 +11:00
Region.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
RegionExtras.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
SourceFile.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
SourcePos.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
StaticFun.thy licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
StrictC.grm licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
StrictC.lex licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
StrictCParser.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
Target-generic32.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
TargetNumbers-sig.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
TypHeapLib.thy c-parser: update to Isabelle2023 maps-to syntax 2023-10-06 14:31:27 +11:00
UMM_Proofs.ML lib+asmrefine+autocorres+c-parser+proof: update to Isabelle2024 2024-06-12 13:25:18 +10:00
UMM_termstypes.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
basics.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
calculate_state.ML Ensure that umm_types.txt is saved relative to theory file. (#674) 2024-01-27 18:47:54 +11:00
complit.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
expression_translation.ML isabelle-2021: cparser+tests update 2021-09-30 16:53:17 +10:00
expression_typing.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
globalmakevars licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
heapstatetype.ML lib+asmrefine+autocorres+c-parser+proof: update to Isabelle2024 2024-06-12 13:25:18 +10:00
hp_termstypes.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
isa_termstypes.ML isabelle-2021: cparser+tests update 2021-09-30 16:53:17 +10:00
isar_install.ML If cpp_path is relative, make it relative to the current theory. (#676) 2024-01-27 18:41:18 +11:00
mkrelease c-parser: update to Isabelle2025 2025-06-13 13:20:24 +10:00
modifies_proofs.ML c-parser: update to Isabelle2025 2025-06-13 13:20:24 +10:00
name_generation.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
openUnsynch.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
program_analysis.ML c-parser: use fresh names for temporaries 2021-03-02 19:39:12 +11:00
shorten_names.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
static-fun.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
stmt_translation.ML isabelle2021-1: remove extend from TheoryData 2022-03-29 08:38:25 +11:00
syntax_transforms.ML c-parser: use fresh names for temporaries 2021-03-02 19:39:12 +11:00
termstypes-sig.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
termstypes.ML isabelle-2021: cparser+tests update 2021-09-30 16:53:17 +10:00
topo_sort.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00
use.ML licenses: convert license tags to SPDX 2020-03-13 14:38:24 +08:00

README.md

The StrictC translation tool

The StrictC translation tool, also called the Isabelle C parser, translates a large subset of C99 code into the imperative language Simpl embedded in the theorem prover Isabelle/HOL. The Simpl language provides a verified verification condition generator and further tools for software verification. The tool is aimed at Isabelle/HOL experts with knowledge in program verification, reasoning in Isabelle/HOL, Hoare logic, and C semantics.

The semantics the parser produces contains a C memory model that can be used to reason about the behaviour of low-level C programs. The memory model admits more behaviours than the C standard -- in particular, it does not require that memory be allocated via alloc, because this library function does typically not yet exist in low-level code such as OS kernel implementation.

To install, we recommend using one of the releases provided below and see the file INSTALL in the src/c-parser directory. You will need Isabelle and the MLton compiler for Standard ML.

To use:

  1. Use the Isabelle session heap CParser that is created by installation
  2. Import the theory CTranslation
  3. Load ('install') C files into your theories with the Isar command install_C_file.

The AutoCorres tool can abstract and simplify most Simpl C code generated by the parser and is aimed at easing C verification. See the AutoCorres web page for more information.

Documentation

The releases contain the file docs/ctranslation.pdf which provides more information about the options and C language semantics that this tool provides.

See also the examples in the testfiles directory. For example, breakcontinue.thy is a fairly involved demonstration of doing things the hard way.

The following academic publications describe the C parser, C subset, and memory model:

Supported C Subset

The C parser supports a large subset of C99. The following C features are not supported:

  • taking the address of local variables
  • floating point types
  • side effects in expressions, pre-increment and pre-decrement operators
  • goto
  • switch fall-through cases
  • variadic argument lists (...)
  • static local variables
  • limited support for function pointers

Releases

Current release:

Older releases:

License

The StrictC translation tool itself is available under the BSD 2-Clause license. It builds on the following open source projects by others.

  1. Norbert Schirmer's Simpl language and associated VCG tool.

    Sources for this are found in the Simpl/ directory. The code is covered by the LGPL licence.

    See https://isa-afp.org/entries/Simpl.html

  2. Code from SML/NJ:

    • an implementation of binary sets (Binaryset.ML)
    • the mllex and mlyacc tools (tools/{mllex,mlyacc})
    • command-line option parsing (standalone-parser/GetOpt)

    This code is covered by SML/NJ's BSD-ish licence.

    See http://www.smlnj.org

  3. Code from the mlton compiler:

    • regions during lexing and parsing (Region.ML, SourceFile.ML and SourcePos.ML)

    This code is governed by a BSD licence.

    See http://mlton.org