Expand description
The ACSL subset fic reads, lifted from Frama-C’s typed logic AST.
ACSL is C’s contract language and the one Frama-C checks. This module
parses nothing. Frama-C has already parsed and typed the annotations, and
the fic-acsl plugin hands over the result as JSON: the Cil_types
nodes under their constructor names.
What is here is the lifting of that tree into the language-neutral
Terms of crate::foreign::contract, which derives the
deterministic return value the model uses.
The subset: literals, parameters, the
return value, \old, arithmetic, comparisons, ! && ||, ? :. Frama-C
has normalised before fic sees anything — a chained 0 <= r < N is
already the conjunction, N from a #define is already 5, \old is
inserted where an ensures names a parameter, and every C-to-logic
integer promotion is a cast flagged implicit, which lifts to its operand.
Quantifiers, memory predicates and accesses (\valid, *p), implication,
bit operators and C casts are outside the subset and are reported by the
construct’s ACSL name, so a contract never seems to have been read when
it was not.
Only the default behaviour is read; named behaviours, assumes,
terminates and exits are the verifier’s. An assigns clause is read
only for purity: assigns \nothing; marks the function side-effect free,
which is what lets it appear in a guard; anything else — including no
clause at all, since ACSL’s default permits everything — makes it impure.
§Running Frama-C
Once per file with ACSL, at extraction; the fic-acsl/ plugin prints each
specified function as JSON. A failure drops the contracts, leaving the
calls opaque. The binary is $FRAMAC or frama-c; $FIC_ACSL_PLUGIN
names a plugin build that is not installed.
Structs§
- Behavior
- One ACSL behaviour.
- Clause
- One clause: Frama-C’s pretty-print of it, and its tree.
- Ensures
- One post-condition.
- FnSpec
- A function’s specification as the
fic-acslplugin prints it. - Written
- One location an
assignsclause names.
Enums§
- Assigns
- An
assignsclause.
Functions§
- from_
foreign - Build and check the contract of a C function from its specification.