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
16830071
Commit
16830071
authored
10 months ago
by
Kilyan Le Gallic
Committed by
Loïc Correnson
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
[wp] Reworked global env as a record
parent
6e9291ec
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
+25
-23
25 additions, 23 deletions
src/plugins/wp/Why3Import.ml
with
25 additions
and
23 deletions
src/plugins/wp/Why3Import.ml
+
25
−
23
View file @
16830071
...
...
@@ -28,6 +28,8 @@ module F = Filepath.Normalized
module
W
=
Why3
module
WConf
=
Why3
.
Whyconf
let
dkey
=
L
.
register_category
"why3.import"
(* -------------------------------------------------------------------------- *)
...
...
@@ -108,21 +110,18 @@ type tenv = C.logic_type_info W.Ty.Hts.t
type
lenv
=
C
.
logic_info
W
.
Term
.
Hls
.
t
type
tvars
=
C
.
logic_type
W
.
Ty
.
Mtv
.
t
type
genv
=
W
.
Env
.
env
*
tenv
*
lenv
module
LogicMap
=
Map
.
Make
(
struct
type
t
=
C
.
logic_info
let
compare
=
compare
(* Use the default comparison function for type A *)
end
)
module
TypeMap
=
Map
.
Make
(
struct
type
t
=
C
.
logic_type
let
compare
=
compare
(* Use the default comparison function for type A *)
end
)
type
lils
=
W
.
Term
.
lsymbol
Logic_info
.
Hashtbl
.
t
type
ltits
=
W
.
Ty
.
tysymbol
Logic_type_info
.
Hashtbl
.
t
type
menv
=
C
.
global
Datatype
.
String
.
Hashtbl
.
t
type
_reverse_logic_info
=
W
.
Term
.
lsymbol
LogicMap
.
t
type
_reverse_logic_type
=
W
.
Ty
.
tysymbol
TypeMap
.
t
type
genv
=
{
wenv
:
W
.
Env
.
env
;
tenv
:
tenv
;
lenv
:
lenv
;
lils
:
lils
;
ltits
:
ltits
;
menv
:
menv
}
(* -------------------------------------------------------------------------- *)
(* --- Built-in --- *)
...
...
@@ -131,21 +130,21 @@ type _reverse_logic_type = W.Ty.tysymbol TypeMap.t
let
add_builtin
(
tenv
:
tenv
)
ts
lt_name
lt_params
=
W
.
Ty
.
Hts
.
add
tenv
ts
C
.{
lt_name
;
lt_params
;
lt_def
=
None
;
lt_attr
=
[]
}
let
find_ts
((
wenv
,_,_
)
:
genv
)
pkg
thy
name
=
let
th
=
Why3
.
Env
.
read_theory
wenv
pkg
thy
in
let
find_ts
genv
pkg
thy
name
=
let
th
=
Why3
.
Env
.
read_theory
genv
.
wenv
pkg
thy
in
try
Why3
.
Theory
.
ns_find_ts
th
.
th_export
name
with
Not_found
->
L
.
fatal
"Cannot find %s.%s.%s"
(
String
.
concat
"."
pkg
)
thy
(
String
.
concat
"."
name
)
let
add_builtins
((
wenv
,
tenv
,
lenv
)
:
genv
)
=
let
add_builtins
genv
=
begin
let
ts_list
=
find_ts
(
wenv
,
tenv
,
lenv
)
[
"list"
]
"List"
[
"list"
]
in
let
ts_set
=
find_ts
(
wenv
,
tenv
,
lenv
)
[
"set"
]
"Set"
[
"set"
]
in
add_builtin
tenv
W
.
Ty
.
ts_bool
Utf8_logic
.
boolean
[]
;
add_builtin
tenv
ts_list
"
\\
list"
[
"A"
];
add_builtin
tenv
ts_set
"set"
[
"A"
];
let
ts_list
=
find_ts
genv
[
"list"
]
"List"
[
"list"
]
in
let
ts_set
=
find_ts
genv
[
"set"
]
"Set"
[
"set"
]
in
add_builtin
genv
.
tenv
W
.
Ty
.
ts_bool
Utf8_logic
.
boolean
[]
;
add_builtin
genv
.
tenv
ts_list
"
\\
list"
[
"A"
];
add_builtin
genv
.
tenv
ts_set
"set"
[
"A"
];
end
(* -------------------------------------------------------------------------- *)
...
...
@@ -287,7 +286,10 @@ let () =
let
wenv
=
create_why3_env
@@
libs
in
let
tenv
:
tenv
=
W
.
Ty
.
Hts
.
create
0
in
let
lenv
:
lenv
=
W
.
Term
.
Hls
.
create
0
in
let
genv
:
genv
=
(
wenv
,
tenv
,
lenv
)
in
let
lils
:
lils
=
Logic_info
.
Hashtbl
.
create
0
in
let
ltits
:
ltits
=
Logic_type_info
.
Hashtbl
.
create
0
in
let
menv
:
menv
=
Datatype
.
String
.
Hashtbl
.
create
0
in
let
genv
:
genv
=
{
wenv
;
tenv
;
lenv
;
lils
;
ltits
;
menv
}
in
add_builtins
genv
;
List
.
iter
(
import_theory
wenv
tenv
lenv
)
@@
imports
;
W
.
Ty
.
Hts
.
iter
(
fun
(
tys
)
(
lti
)
->
...
...
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