Skip to content
Snippets Groups Projects
Commit d58fbdaa authored by Julien Signoles's avatar Julien Signoles
Browse files

Merge branch 'feature/e-acsl/refman-upgrade-vanadium' into 'stable/vanadium'

Feature/e acsl/refman upgrade vanadium

See merge request frama-c/frama-c!3264
parents 4d203049 fde2841f
No related branches found
No related tags found
No related merge requests found
Showing
with 219 additions and 98 deletions
...@@ -17,7 +17,11 @@ DEPS_MODERN=macros_modern.tex eacslversion.tex biblio.bib \ ...@@ -17,7 +17,11 @@ DEPS_MODERN=macros_modern.tex eacslversion.tex biblio.bib \
assertions_modern.bnf loops_modern.bnf st_contracts_modern.bnf \ assertions_modern.bnf loops_modern.bnf st_contracts_modern.bnf \
logic_modern.bnf data_invariants_modern.bnf model_modern.bnf \ logic_modern.bnf data_invariants_modern.bnf model_modern.bnf \
ghost_modern.bnf generalinvariants_modern.bnf iterator_modern.bnf \ ghost_modern.bnf generalinvariants_modern.bnf iterator_modern.bnf \
abrupt_modern.bnf bsearch.c bsearch2.c link.c guarded_quantif_modern.bnf inductive_modern.bnf logicdecl_modern.bnf \
higherorder_modern.bnf logictypedecl_modern.bnf logicreads_modern.bnf \
allocation_modern.bnf abrupt_modern.bnf dependencies_modern.bnf \
volatile-gram_modern.bnf \
bsearch.c bsearch2.c link.c
############## ##############
# Main rules # # Main rules #
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
\ \
{ exits-clause } ::= { "exits" pred ";" } { exits-clause } ::= { "exits" pred ";" }
\ \
{ abrupt-clause-stmt } ::= { breaks-clause } | { continues-clause } | { returns-clause } { abrupt-clause-stmt } ::= { breaks-clause } | { continues-clause } |
{ returns-clause } ;
{ exits-clause }
\ \
{ breaks-clause } ::= { "breaks" pred ";" } { breaks-clause } ::= { "breaks" pred ";" }
\ \
......
\begin{syntax}
{ allocation-clause } ::= { "allocates" dyn-allocation-addresses ";" } ;
| { "frees" dyn-allocation-addresses ";" } ;
\
{ loop-allocation } ::= { "loop" "allocates" dyn-allocation-addresses ";" };
| { "loop" "frees" dyn-allocation-addresses ";" };
\
{ dyn-allocation-addresses } ::= { locations } ;
\end{syntax}
\begin{syntax} \begin{syntax}
C-compound-statement ::= "{" declaration* statement* assertion+ "}" C-compound-statement ::=
\ "{" C-declaration* ;
C-statement ::= assertion statement \ C-statement* assertion+ "}"
assertion-kind ::= "assert" | clause-kind \ \
assertion ::= "/*@" assertion-kind pred ";" "*/" ; C-statement ::= assertion ;
| { "/*@" "for" id ("," id)* ":" assertion-kind pred ";" "*/" } ; C-statement
\
assertion-kind ::= "assert" ; assertion
| clause-kind ; non-blocking assertion
\
assertion ::= "/*@" assertion-kind pred";" ;
"*/" ;
| { "/*@" "for" id ("," id)*":" } ;
{ assertion-kind pred";" };
{ "*/" }
\end{syntax} \end{syntax}
main(void) { main(void) {
int m = 2; int m = 2;
int n = 7;; int n = 7;;
K: ; L1: ;
n = 875; n = 4;
L2:
/*@ assert /*@ assert
\let k = 3; \let k = m + 1;
\exists integer u; 9 <= u < 21 && \exists integer u; 9 <= u < 21 &&
\forall integer v; -5 < v <= (u < 15 ? u + 6 : k) ==> \forall integer v; -5 < v <= (u < 15 ? u + 6 : k) ==>
\at(n + u + v > 0, K); */ ; \at(n + u + v > 0, K); */ ;
/*@ assert
\let k = m + 1;
\exists integer u; n <= u < 21 && // [u] depends on [n]
\forall integer v; -5 < v <= (u < 15 ? u + 6 : k) ==>
\at(n + u + v > 0, L1); */ ;
return 0; return 0;
} }
/*@ ensures \forall int i; 0 <= i < n-1 ==> \old(t[i]) == t[i+1]; */ /*@ ensures \forall int i; 0 <= i < n-1 ==> \old(t[i]) == t[i+1]; */
void reverse(int *t, int n) { } void reverse(int *t, int n);
...@@ -61,13 +61,21 @@ Virgile Prevosto and Armand Puccetti and Julien Signoles and Boris Yakobowski}, ...@@ -61,13 +61,21 @@ Virgile Prevosto and Armand Puccetti and Julien Signoles and Boris Yakobowski},
note = {\url{https://frama-c.com/fc-plugins/e-acsl.html}}, note = {\url{https://frama-c.com/fc-plugins/e-acsl.html}},
} }
@manual{value, @manual{eva,
title = {Frama-C's Evolved Value Analysis analysis plug-in}, title = {Eva --- The Evolved Value Analysis Plug-in},
author = {Pascal Cuoq and Boris Yakobowski and Matthieu Lemerre and author = {David B\"uhler and Pascal Cuoq and Boris Yakobowski and
André Maroneze and Valentin Perelle and Virgile Prevosto}, Matthieu Lemerre and André Maroneze and Valentin Perelle and
Virgile Prevosto},
note = {\url{https://frama-c.com/fc-plugins/eva.html}}, note = {\url{https://frama-c.com/fc-plugins/eva.html}},
} }
@manual{wp,
title = {Wp Plug-in Manual},
author = {Patrick Baudin and François Bobot and Lo\"ic Correnson and
Zaynah Dargaye and Allan Blanchard},
note = {\url{https://frama-c.com/fc-plugins/wp.html}},
}
@book{KR88, @book{KR88,
author = {Brian Kernighan and Dennis Ritchie}, author = {Brian Kernighan and Dennis Ritchie},
title = {The C Programming Language (2nd Ed.)}, title = {The C Programming Language (2nd Ed.)},
......
\section{Changes} \section{Changes}
% Next version % Next version
%\subsection*{Version \version} \subsection*{Version \version}
\begin{itemize}
\item \changeinsection{expressions}{xor \lstinline|\^\^| is not lazy}
\item \changeinsection{expressions}{new extended syntax for quantifications}
\item \changeinsection{reals}{additional remark about real numbers and
operations over them}
\item \changeinsection{locations}{new extended syntax for set comprehensions}
\item \changeinsection{at}{more restrictive scoping rule for \lstinline|\\at|
constructs.}
\item \changeinsection{logicspec}{add lemmas and data invariants}
\item \changeinsection{inductivepredicates}{add inductive predicates
experimentally: the accepted subset will be refined in a future version}
\item \changeinsection{axiomatic}{add axiomatic declarations
experimentally: the accepted subset will be refined in a future version}
\item \changeinsection{polym-logic-types}{add polymorphic logic types}
\item \changeinsection{higherorder}{add higher-order logic constructions}
\item \changeinsection{concrete-logic-types}{add concrete logic types}
\item \changeinsection{reads}{add \lstinline|read| clauses}
\item \changeinsection{func-dep}{add dependencies information}
\item \changeinsection{volatile-variables}{add volatile constructs}
\end{itemize}
\subsection*{Version 1.16} \subsection*{Version 1.16}
\begin{itemize} \begin{itemize}
...@@ -157,7 +178,8 @@ in \lstinline|\\at|} ...@@ -157,7 +178,8 @@ in \lstinline|\\at|}
\begin{itemize} \begin{itemize}
\item \changeinsection{expressions}{mark logic function and predicate \item \changeinsection{expressions}{mark logic function and predicate
applications as implemented} applications as implemented}
\item \changeinsection{fn-behavior}{mark admit clauses as implemented} \item \changeinsection{fn-behavior}{mark admit and check clauses as implemented}
\item \changeinsection{loop_annot}{mark loop variants as implemented}
\end{itemize} \end{itemize}
\subsection*{Version Titanium-22} \subsection*{Version Titanium-22}
......
...@@ -4,6 +4,6 @@ ...@@ -4,6 +4,6 @@
This document presents an Executable ANSI/ISO C Specification Language. It This document presents an Executable ANSI/ISO C Specification Language. It
provides a subset of \acsl~\cite{acsl} implemented~\cite{acslimplem} in the provides a subset of \acsl~\cite{acsl} implemented~\cite{acslimplem} in the
\framac platform~\cite{framac} in which each construct may be evaluated at \framac platform~\cite{framac} in which each construct may be evaluated at
runtime. The specification language described here is intented to evolve in the runtime. The specification language described here is intended to evolve in the
future in two directions. First it is based on \acsl which is itself still future in two directions. First it is based on \acsl which is itself still
evolving. Second the considered subset of \acsl may also change. evolving. Second the considered subset of \acsl may also change.
\begin{syntax} \begin{syntax}
declaration ::= { "/*@" data-inv-decl "*/" } { data-inv-def } ::= { data-invariant } | { type-invariant }
\
{ data-inv-decl } ::= { data-invariant } | { type-invariant }
\ \
{ data-invariant } ::= { { inv-strength? } "global" "invariant" } ; { data-invariant } ::= { { inv-strength? } "global" "invariant" } ;
{ id ":" pred ";" } { id ":" pred ";" }
......
\begin{syntax}
{ assigns-clause } ::= { "assigns" locations-list ("\from" locations )? ";" } ;
| { "assigns" term "\from" locations "=" term ";" }
\end{syntax}
...@@ -7,14 +7,16 @@ ...@@ -7,14 +7,16 @@
\ \
requires-clause ::= clause-kind? "requires" pred ";" requires-clause ::= clause-kind? "requires" pred ";"
\ \
{ decreases-clause } ::= { "decreases" term ("for" id)? ";" } { decreases-clause } ::= { "decreases" term ("for" ident)? ";" }
\ \
[ simple-clause ] ::= { assigns-clause } | ensures-clause ; simple-clause ::= { assigns-clause } | ensures-clause ;
| { allocation-clause} | { abrupt-clause } | { allocation-clause} | { abrupt-clause }
\ \
{ assigns-clause } ::= { "assigns" locations ";" } { assigns-clause } ::= { "assigns" locations ";" }
\ \
{ locations } ::= { location ("," location) * | "\nothing" } { locations } ::= { locations-list | "\nothing" }
\
{ locations-list } ::= { location ("," location) * }
\ \
{ location } ::= { tset } { location } ::= { tset }
\ \
......
\begin{syntax} \begin{syntax}
C-type-qualifier ::= C-type-qualifier ; C-type-qualifier ::= { "\ghost" } ; only in ghost
| { "\ghost" } ; only in ghost
\ \
ghost-type-specifier ::= C-type-specifier ; C-type-specifier ::= { logic-type }
| { logic-type } \ \
declaration ::= C-declaration ; logic-def ::= "ghost" C-declaration ;
| "/*@" "ghost" ghost-declaration "*/" \ \
direct-declarator ::= C-direct-declarator ; C-direct-declarator ::=
| direct-declarator ; C-direct-declarator ; function declarator
"(" C-parameter-type-list? ")"; "(" C-parameter-type-list? ;
{"/*@" "ghost"}; ")" "/*@" "ghost" "(" ;
{"("ghost-parameter-list")"}; C-parameter-type-list; with ghost params
{"*/"}; ghost args ")" "*/";
\ \
postfix-expression ::= C-postfix-expression ; C-postfix-expression ::=
| postfix-expression ; C-postfix-expression ; function call
"(" C-argument-expression-list? ")"; "(" C-argument-expression-list? ;
{"/*@" "ghost"} ; ")" "/*@" "ghost" "(" ;
{ "(" ghost-argument-expression-list ")"}; C-argument-expression-list; with ghost args
{ "*/"} ; call ")";
; with ghosts "*/" ;
\ \
statement ::= C-statement ; C-statement ::=
| statements-ghost \ "/*@" "ghost";
statements-ghost ::= "/*@" "ghost" ; C-statement+ ; ghost code
ghost-statement+ "*/" \ "*/" ;
ghost-selection-statement ::= C-selection-statement ;
| "if" "(" C-expression ")"; | "if" "(" C-expression ")";
statement; statement;
{"/*@" "ghost" "else"}; "/*@" "ghost" ;
{ ghost-statement+ }; "else" C-statement ; ghost alternative
{ "*/"} \ C-statement* ; unconditional ghost code
"*/"
struct-declaration ::= C-struct-declaration ; \
| {"/*@" "ghost" }; C-struct-declaration ::=
{struct-declaration "*/"} ; ghost field {"/*@" "ghost" };
{C-struct-declaration} ; ghost field
{"*/"}
\end{syntax} \end{syntax}
\begin{syntax}
guarded-quantif ::= "\forall" binders ";" (guards "==>")+ pred ;
| "\exists" binders ";" guards "&&" pred ;
\
guards ::= interv ("&&" interv)* ;
\
interv ::= term (guard-op id)+ guard-op term ;
\
guard-op ::= "<=" | "<" ;
\end{syntax}
\begin{syntax}
term ::= { "\lambda" binders ";" term } ; abstraction
| { ext-quantifier "(" term "," term "," term ")" };
| { "{" term "\with" "[" range "]" "=" term "}" } ;
\
{ ext-quantifier } ::= { "\max" } | { "\min" } | { "\sum" };
| { "\product" } | { "\numof" }
\end{syntax}
\begin{syntax}
logic-def ::= { inductive-def }
\
{ inductive-def } ::= { "inductive" } ;
{ poly-id parameters? "{" indcase* "}" }
\
{ indcase } ::= { "case" poly-id ":" pred ";" }
\end{syntax}
...@@ -8,9 +8,8 @@ This document is a reference manual for ...@@ -8,9 +8,8 @@ This document is a reference manual for
{E-ACSL.} {E-ACSL.}
\eacsl is an acronym for ``Executable ANSI/ISO C \eacsl is an acronym for ``Executable ANSI/ISO C
Specification Language''. It is an ``executable'' subset of Specification Language''. It is an ``executable'' subset of
\emph{stable} \acsl~\cite{acsl} implemented~\cite{acslimplem} in the \framac \acsl~\cite{acsl} implemented~\cite{acslimplem} in the \framac
platform~\cite{framac}. ``Stable'' means that no experimental \acsl feature is platform~\cite{framac}. Contrary to \acsl, each \eacsl specification is
supported by \eacsl. Contrary to \acsl, each \eacsl specification is
executable: it may be evaluated at runtime. executable: it may be evaluated at runtime.
In this document, we assume that the reader has a good knowledge of both In this document, we assume that the reader has a good knowledge of both
...@@ -47,28 +46,53 @@ currently implemented into the \framac's \eacsl plug-in. ...@@ -47,28 +46,53 @@ currently implemented into the \framac's \eacsl plug-in.
& mathematical reals \\ & mathematical reals \\
\hline \hline
terms terms
& \lstinline|\\true| and \lstinline|\\false| \\ & truth values \lstinline|\\true| and \lstinline|\\false| \\
& let binding \\ & functional updates \\
& irrational numbers \\
& built-in function \lstinline|\\length| over arrays \\
& conversions of structure to structure \\
& t-sets \\ & t-sets \\
& higher-order logic constructs \\
& hybrid functions \\
& labeled memory-related built-in functions \\
& finite sets \\
& finite lists \\
& \lstinline|\\exit_status|
\\
\hline \hline
predicates predicates
& exclusive or operator \\ % \lstinline|^^| & let bindings of predicates \\
& let bindings \\ & unguarded quantifications over small types \\
& quantifications over non-integer types \\ & quantifications over pointers and enums \\
& \lstinline|\\specified| & iterators \\
& comparisons of unions and structures \\
& t-sets \\
& hybrid predicates \\
& labeled memory-related built-in predicates \\
& dangling pointers \lstinline|\\dangling|
\\ \\
\hline \hline
annotations clauses
& behavior-specific annotations \\ & decreases clauses \\
& loop assigns \\ & assigns clauses \\
& global annotations & allocation and deallocation clauses \\
& abrupt clauses \\
& reads clauses
\\ \\
\hline \hline
behavior clauses annotations
& assigns \\ & behavior-specific annotations (introduced by \lstinline|for|) \\
& allocates \\ & loop assigns \\
& decreases \\ & loop allocations \\
& abrupt termination & lemmas \\
& inductive predicates \\
& axiomatic definitions \\
& polymorphic logic types \\
& concrete logic types \\
& specification modules \\
& data invariants \\
& model variables and model fields \\
& volatile variables
\\ \\
\hline \hline
\end{tabular} \end{tabular}
......
\begin{syntax} \begin{syntax}
declaration ::= [ { "//@" "iterator" id "("wildcard-param"," [ { iterator } ] ::= [ { "\forall" binders ";" iterator-guard "==>" pred } ];
| [ { "\exists" binders ";" iterator-guard "&&" pred } ] ;
\
[ { iterator-guard } ] ::= [ { id"("term"," term")" } ]
\
[ { declaration } ] ::= [ { "//@" "iterator" id "("wildcard-param","
wildcard-param")" ":" } ] ; wildcard-param")" ":" } ] ;
[ { "nexts" terms ";" "guards" predicates ";" } ] [ { "nexts" terms ";" "guards" predicates ";" } ]
\ \
[ { wildcard-param } ] ::= { parameter } ; [ { wildcard-param } ] ::= { parameter } ;
| [ { "_" } ] | [ { "_" } ]
\ \
[ { terms } ] ::= [ { term (, term)* } ] { terms } ::= { term (, term)* }
\ \
[ { predicates } ] ::= [ { predicate (, predicate)* } ] { predicates } ::= { predicate (, predicate)* }
\end{syntax} \end{syntax}
\begin{syntax} \begin{syntax}
term ::= "[|" "|]" ; empty list term ::= { "[|" "|]" } ; empty list
| "[|" term ("," term)* "|]" ; list of elements | { "[|" term ("," term)* "|]" } ; list of elements
| term "^" term ; list concatenation (overloading bitwise-xor | { term "^" term } ; list concatenation (overloading bitwise-xor
; operator) ; operator)
| term "*^" term ; list repetition | { term "*^" term } ; list repetition
\end{syntax} \end{syntax}
\begin{syntax} \begin{syntax}
tset ::= { "\empty" } ; empty set [ range ] ::= [ term ".." term ] ;
| tset "->" id ; \
| tset "." id ; [ tset ] ::= { "\empty" } ; empty set
| "*" tset ; | { tset "->" id } ;
| "&" tset ; | { tset "." id } ;
| tset "[" tset "]" ; | { "*" tset } ;
| [ term ".." term ] ; range | { "&" tset } ;
| { "\union" "(" tset ("," tset)* ")" } ; union of locations | { tset "[" tset "]" } ;
| { "\inter" "(" tset ("," tset)* ")" }; intersection | { tset "[" range "]" } ;
| "(" range ")" ; a range as a set of integers
| { "\union" "(" tset ("," tset)* ")" } ; union of location sets
| { "\inter" "(" tset ("," tset)* ")" } ; intersection of location sets
| tset "+" tset ; | tset "+" tset ;
| "(" tset ")" ; | "(" tset ")" ;
| {[the given term cannot itself be a set] | [ { "{" tset "|" binders";" constraints "}" } ] ; set comprehension
"{" tset "|" binders (";" pred)? "}"} ; set comprehension | { "{" (term ("," term)*)? "}" } ; explicit set
| {[the given terms cannot themselves be a set]
"{" (tset ("," tset)*)? "}" };
| term ; implicit singleton | term ; implicit singleton
\ \
pred ::= { "\subset" "(" tset "," tset ")" } ; set inclusion pred ::= { "\subset" "(" tset "," tset ")" } ; set inclusion
| { term "\in" tset } ; set membership | { term "\in" tset } ; set membership
\
{ constraints } ::= { guards ("&&" pred)? }
\end{syntax} \end{syntax}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment