Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Iris
RefinedC
Commits
5c28c244
Commit
5c28c244
authored
Nov 17, 2021
by
Rodolphe Lepigre
Committed by
Paul
Dec 03, 2021
Browse files
A tiny extension of frontend syntax.
parent
e02efb12
Changes
3
Hide whitespace changes
Inline
Side-by-side
ANNOTATIONS.md
View file @
5c28c244
...
...
@@ -269,7 +269,7 @@ Coq import to bring theorem `thm` in scope: `From x.y Require Import z.`.
This annotation can appear either on functions and on structures. It should be
given at least one argument of the following form.
```
<ident (as variable
nam
e)> ":" <coq_expr (as Coq type)>
<ident (as variable
)> {"," <ident (as variabl
e)>
}*
":" <coq_expr (as Coq type)>
```
It corresponds to an universally quantified variable with the given type. When
on a function, such a variable is bound in the whole specification. Similarly,
...
...
examples/bff_paper_example.c
View file @
5c28c244
...
...
@@ -78,7 +78,7 @@ static bool pte_valid(pte_t pte) {
//@rc::end
[[
rc
::
requires
(
"{bitfield_wf old}"
,
"{bitfield_wf pa}"
,
"{bitfield_wf attr}"
)]]
// FIXME not necessary.
[[
rc
::
parameters
(
"p : loc"
,
"old
: Pte"
,
"
pa
: Pte"
,
"
attr : Pte"
,
"lvl : Z"
)]]
[[
rc
::
parameters
(
"p : loc"
,
"old, pa, attr : Pte"
,
"lvl : Z"
)]]
[[
rc
::
args
(
"p @ &own<old @ pte_t>"
,
"pa @ pte_t"
,
"attr @ pte_t"
,
"lvl @ int<u32>"
)]]
[[
rc
::
requires
(
"{old.(pte_valid) = false}"
)]]
[[
rc
::
returns
(
"{true} @ boolean<bool_it>"
)]]
...
...
frontend/rc_annot.ml
View file @
5c28c244
...
...
@@ -226,8 +226,8 @@ let type_expr = type_expr `Full
(** {4 Annotations on type definitions} *)
let parser annot_parameter : (ident * coq_expr) Earley.grammar =
| id:ident
"
:
" s:coq_expr
let parser annot_parameter : (ident
list
* coq_expr) Earley.grammar =
| id:ident
ids:{"
,
" ident}* "
:
" s:coq_expr -> (id :: ids, s)
let parser annot_refine : (ident * coq_expr) Earley.grammar =
| id:ident "
:
" s:coq_expr
...
...
@@ -436,8 +436,12 @@ let parse_attr : rc_attr -> annot = fun attr ->
| _ -> error "
should
not
have
arguments
"
in
let mk_annot_parameters l =
let fn (ids, ty) = List.map (fun id -> (id, ty)) ids in
Annot_parameters(List.concat (List.map fn l))
in
match id.elt with
| "
parameters
" -> many_args annot_parameter
(fun l -> A
nnot_parameters
(l))
| "
parameters
" -> many_args annot_parameter
mk_a
nnot_parameters
| "
refined_by
" -> many_args annot_refine (fun l -> Annot_refined_by(l))
| "
ptr_type
" -> single_arg annot_ptr_type (fun e -> Annot_ptr_type(e))
| "
size
" -> single_arg annot_size (fun e -> Annot_size(e))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment