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
cf3b5135
Commit
cf3b5135
authored
1 year ago
by
Loïc Correnson
Browse files
Options
Downloads
Patches
Plain Diff
[wp] draft of ty converter
parent
a4ba5576
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/Why3Import.ml
+35
-0
35 additions, 0 deletions
src/plugins/wp/Why3Import.ml
with
35 additions
and
0 deletions
src/plugins/wp/Why3Import.ml
+
35
−
0
View file @
cf3b5135
...
...
@@ -20,6 +20,7 @@
(* *)
(**************************************************************************)
module
C
=
Cil_types
module
L
=
Wp_parameters
module
T
=
Why3
.
Theory
module
F
=
Filepath
.
Normalized
...
...
@@ -69,6 +70,40 @@ let pp_id_loc fmt (id : W.Ident.ident) =
@since Phosphorus-20170501-beta1 *)
}*)
type
tenv
=
C
.
logic_type_info
W
.
Ty
.
Hts
.
t
type
tvars
=
C
.
logic_type
W
.
Ty
.
Mtv
.
t
let
rec
lt_of_ty
(
tenv
:
tenv
)
(
tvs
:
tvars
)
(
ty
:
W
.
Ty
.
ty
)
:
C
.
logic_type
=
match
ty
.
ty_node
with
|
Tyvar
x
->
W
.
Ty
.
Mtv
.
find
x
tvs
|
Tyapp
(
s
,
ts
)
->
C
.
Ltype
(
ls_of_ts
tenv
s
,
List
.
map
(
lt_of_ty
tenv
tvs
)
ts
)
and
ls_of_ts
(
tenv
:
tenv
)
(
ts
:
W
.
Ty
.
tysymbol
)
:
C
.
logic_type_info
=
try
W
.
Ty
.
Hts
.
find
tenv
ts
with
Not_found
->
let
lt_params
=
List
.
map
(
fun
(
tv
:
W
.
Ty
.
tvsymbol
)
->
tv
.
tv_name
.
id_string
)
ts
.
ts_args
in
let
lt_def
=
match
ts
.
ts_def
with
|
NoDef
|
Range
_
|
Float
_
->
None
|
Alias
ty
->
let
tvars
=
List
.
fold_left
(
fun
(
tvs
:
tvars
)
(
tv
:
W
.
Ty
.
tvsymbol
)
->
W
.
Ty
.
Mtv
.
add
tv
(
C
.
Lvar
tv
.
tv_name
.
id_string
)
tvs
)
W
.
Ty
.
Mtv
.
empty
ts
.
ts_args
in
Some
(
C
.
LTsyn
(
lt_of_ty
tenv
tvars
ty
))
in
let
lti
=
C
.{
lt_name
=
ts
.
ts_name
.
id_string
;
lt_params
;
lt_def
;
lt_attr
=
[]
;
}
in
W
.
Ty
.
Hts
.
add
tenv
ts
lti
;
lti
let
rec
_lt_of_ts
(
ty
:
W
.
Ty
.
ty
)
=
match
ty
.
ty_node
with
|
W
.
Ty
.
Tyvar
tvs
->
...
...
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