Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
7e4d7033
Commit
7e4d7033
authored
11 months ago
by
Kilyan Le Gallic
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Added tlogics env for function stashing for adding to coming CIL AST, inspired from type env
parent
d0317030
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/Why3Import.ml
+22
-14
22 additions, 14 deletions
src/plugins/wp/Why3Import.ml
with
22 additions
and
14 deletions
src/plugins/wp/Why3Import.ml
+
22
−
14
View file @
7e4d7033
...
...
@@ -66,6 +66,7 @@ let pp_li fmt (li : C.logic_info) =
type
tenv
=
C
.
logic_type_info
W
.
Ty
.
Hts
.
t
type
tvars
=
C
.
logic_type
W
.
Ty
.
Mtv
.
t
type
tlogics
=
C
.
logic_info
W
.
Term
.
Hls
.
t
let
tvars_of_txs
(
txs
:
W
.
Ty
.
tvsymbol
list
)
:
string
list
*
tvars
=
List
.
fold_right
...
...
@@ -110,21 +111,22 @@ let lr_of_ty_opt (lt_opt) =
|
Some
tr
->
tr
let
l
t
i_of_ls
(
tenv
:
tenv
)
(
ls
:
W
.
Term
.
lsymbol
)
:
C
.
logic_info
=
let
li_of_ls
(
tenv
:
tenv
)
(
ls
:
W
.
Term
.
lsymbol
)
(
tlogics
:
tlogics
)
:
C
.
logic_info
=
let
l_tparams
,
tvars
=
tvars_of_txs
@@
W
.
Ty
.
Stv
.
elements
@@
W
.
Term
.
ls_ty_freevars
ls
in
let
l_type
=
Option
.
map
(
lt_of_ty
tenv
tvars
)
ls
.
ls_value
in
let
l_profile
=
List
.
mapi
(
lv_of_ty
tenv
tvars
)
ls
.
ls_args
in
let
l_args
=
List
.
map
(
fun
(
lv
:
C
.
logic_var
)
->
lv
.
lv_type
)
l_profile
in
let
signature
=
C
.
Larrow
(
l_args
,
lr_of_ty_opt
l_type
)
in
{
l_var_info
=
Cil_const
.
make_logic_var_global
"?"
signature
;
(*"int::Int::add"*)
l_labels
=
[]
;
l_tparams
;
l_type
;
l_profile
;
l_body
=
C
.
LBnone
;
}
let
li
=
C
.{
l_var_info
=
Cil_const
.
make_logic_var_global
ls
.
ls_name
.
id_string
signature
;
(*"int::Int::add"*)
l_labels
=
[]
;
l_tparams
;
l_type
;
l_profile
;
l_body
=
C
.
LBnone
;
}
in
W
.
Term
.
Hls
.
add
tlogics
ls
li
;
li
(* -------------------------------------------------------------------------- *)
...
...
@@ -134,7 +136,7 @@ let lti_of_ls (tenv:tenv) (ls : W.Term.lsymbol) : C.logic_info =
let
import_theory
env
(
tenv
:
tenv
)
thname
=
let
import_theory
env
(
tenv
:
tenv
)
(
tlogics
:
tlogics
)
thname
=
let
theory_name
,
theory_path
=
extract_path
thname
in
try
let
theory
=
W
.
Env
.
read_theory
env
theory_path
theory_name
in
...
...
@@ -164,7 +166,7 @@ let import_theory env (tenv:tenv) thname =
(
fun
((
ls
,_
)
:
W
.
Decl
.
logic_decl
)
->
L
.
debug
~
level
:
0
"Decl and dlogic %a"
pp_id
ls
.
ls_name
;
L
.
debug
~
level
:
0
"Location %a"
pp_id_loc
ls
.
ls_name
;
let
li
=
l
t
i_of_ls
tenv
l
s
in
let
li
=
li_of_ls
tenv
ls
tlogic
s
in
L
.
debug
~
level
:
0
"Corresponding dlogic LTI %a"
pp_li
li
;
)
dlogics
|
_
->
L
.
debug
~
level
:
0
"Decl but whatever"
...
...
@@ -180,13 +182,19 @@ let () =
Boot
.
Main
.
extend
begin
fun
()
->
let
env
=
create_why3_env
@@
L
.
Library
.
get
()
in
let
tenv
:
tenv
=
W
.
Ty
.
Hts
.
create
3
in
List
.
iter
(
import_theory
env
tenv
)
@@
L
.
Import
.
get
()
;
let
tenv
:
tenv
=
W
.
Ty
.
Hts
.
create
0
in
let
tlogics
:
tlogics
=
W
.
Term
.
Hls
.
create
0
in
List
.
iter
(
import_theory
env
tenv
tlogics
)
@@
L
.
Import
.
get
()
;
L
.
debug
~
level
:
0
"Length of type environment : %d "
(
W
.
Ty
.
Hts
.
length
tenv
);
W
.
Ty
.
Hts
.
iter
(
fun
(
ty
)
(
lti
)
->
L
.
debug
~
level
:
0
"TY %a"
pp_id
ty
.
ts_name
;
L
.
debug
~
level
:
0
"LTI %a"
pp_lti
lti
;
)
tenv
)
tenv
;
W
.
Term
.
Hls
.
iter
(
fun
(
ls
)
(
li
)
->
L
.
debug
~
level
:
0
"TY %a"
pp_id
ls
.
ls_name
;
L
.
debug
~
level
:
0
"LI %a"
pp_li
li
;
)
tlogics
end
(* -------------------------------------------------------------------------- *)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment