Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
why3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nils Fitinghoff
why3
Commits
81de7472
Commit
81de7472
authored
Oct 3, 2018
by
nilfit
Browse files
Options
Downloads
Patches
Plain Diff
add Eassign translation
parent
8e0823a8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mlw/rust_printer.ml
+11
-3
11 additions, 3 deletions
src/mlw/rust_printer.ml
with
11 additions
and
3 deletions
src/mlw/rust_printer.ml
+
11
−
3
View file @
81de7472
...
@@ -47,6 +47,7 @@ module Rust = struct
...
@@ -47,6 +47,7 @@ module Rust = struct
|
Econst
of
string
option
*
BigInt
.
t
|
Econst
of
string
option
*
BigInt
.
t
|
Evar
of
pvsymbol
|
Evar
of
pvsymbol
|
Efield
of
expr
*
ident
|
Efield
of
expr
*
ident
|
Eassign
of
pvsymbol
*
rsymbol
*
pvsymbol
|
Etup
of
expr
list
|
Etup
of
expr
list
|
Eenum
of
rsymbol
*
expr
list
|
Eenum
of
rsymbol
*
expr
list
|
Estruct
of
rsymbol
*
rsymbol
list
*
expr
list
(* Rs { r1: e1, r2: e2 } *)
|
Estruct
of
rsymbol
*
rsymbol
list
*
expr
list
(* Rs { r1: e1, r2: e2 } *)
...
@@ -105,6 +106,7 @@ module Rust = struct
...
@@ -105,6 +106,7 @@ module Rust = struct
|
Esyntax
(
s
,
el
)
->
Esyntax
(
s
,
(
clean_list
el
))
|
Esyntax
(
s
,
el
)
->
Esyntax
(
s
,
(
clean_list
el
))
|
Elet
(
p
,
e1
,
e2
)
->
Elet
(
p
,
clean_expr
e1
,
clean_expr
e2
)
|
Elet
(
p
,
e1
,
e2
)
->
Elet
(
p
,
clean_expr
e1
,
clean_expr
e2
)
|
Efield
(
e
,
id
)
->
Efield
(
clean_expr
e
,
id
)
|
Efield
(
e
,
id
)
->
Efield
(
clean_expr
e
,
id
)
|
Eassign
_
->
e
|
Etup
el
->
Etup
(
clean_list
el
)
|
Etup
el
->
Etup
(
clean_list
el
)
|
Eenum
(
rs
,
el
)
->
Eenum
(
rs
,
clean_list
el
)
|
Eenum
(
rs
,
el
)
->
Eenum
(
rs
,
clean_list
el
)
|
Estruct
(
rs
,
fl
,
el
)
->
Estruct
(
rs
,
fl
,
clean_list
el
)
|
Estruct
(
rs
,
fl
,
el
)
->
Estruct
(
rs
,
fl
,
clean_list
el
)
...
@@ -302,9 +304,11 @@ module MLToRust = struct
...
@@ -302,9 +304,11 @@ module MLToRust = struct
Rust
.
Eif
(
translate_expr
info
ei
,
translate_expr
info
et
,
Rust
.
Eif
(
translate_expr
info
ei
,
translate_expr
info
et
,
translate_expr
info
ee
)
translate_expr
info
ee
)
(* TODO special cases *)
(* TODO special cases *)
|
Mltree
.
Eassign
_
->
|
Eassign
[(
rho
,
rs
,
pv
)]
->
Rust
.
Eassign
(
rho
,
rs
,
pv
)
|
Eassign
al
->
(* struct field assignment *)
(* struct field assignment *)
raise
(
TODO
"Eassign"
)
Rust
.
Eblock
(
List
.
map
(
fun
(
rho
,
rs
,
pv
)
->
Rust
.
Eassign
(
rho
,
rs
,
pv
))
al
)
|
Ematch
(
e1
,
[(
p
,
e2
)]
,
[]
)
->
|
Ematch
(
e1
,
[(
p
,
e2
)]
,
[]
)
->
(* TODO is this always irrefutable? *)
(* TODO is this always irrefutable? *)
Rust
.
Elet
(
translate_pat
info
p
,
translate_expr
info
e1
,
Rust
.
Elet
(
translate_pat
info
p
,
translate_expr
info
e1
,
...
@@ -370,6 +374,7 @@ module MLToRust = struct
...
@@ -370,6 +374,7 @@ module MLToRust = struct
map_and_union
el
map_and_union
el
|
Rust
.
Elet
(
_
,
e1
,
e2
)
->
map_and_union
[
e1
;
e2
]
|
Rust
.
Elet
(
_
,
e1
,
e2
)
->
map_and_union
[
e1
;
e2
]
|
Rust
.
Efield
(
e
,
_
)
->
discover_lts_tvs_expr
e
|
Rust
.
Efield
(
e
,
_
)
->
discover_lts_tvs_expr
e
|
Rust
.
Eassign
_
->
Slt
.
empty
,
Stv
.
empty
(* FIXME *)
|
Rust
.
Etup
el
->
map_and_union
el
|
Rust
.
Etup
el
->
map_and_union
el
|
Rust
.
Eenum
(
_
,
el
)
->
map_and_union
el
|
Rust
.
Eenum
(
_
,
el
)
->
map_and_union
el
|
Rust
.
Estruct
(
_
,
_
,
el
)
->
map_and_union
el
(* TODO check rsymbols*)
|
Rust
.
Estruct
(
_
,
_
,
el
)
->
map_and_union
el
(* TODO check rsymbols*)
...
@@ -763,6 +768,9 @@ module Print = struct
...
@@ -763,6 +768,9 @@ module Print = struct
|
Evar
pv
->
print_pv
info
fmt
pv
|
Evar
pv
->
print_pv
info
fmt
pv
|
Efield
(
e
,
id
)
->
|
Efield
(
e
,
id
)
->
fprintf
fmt
"%a.%a"
(
print_expr
info
)
e
(
print_lident
info
)
id
fprintf
fmt
"%a.%a"
(
print_expr
info
)
e
(
print_lident
info
)
id
|
Eassign
(
rho
,
rs
,
pv
)
->
fprintf
fmt
"%a.%a = %a"
(
print_lident
info
)
(
pv_name
rho
)
(
print_lident
info
)
rs
.
rs_name
(
print_lident
info
)
(
pv_name
pv
)
|
Etup
el
->
fprintf
fmt
"(%a)"
(
print_list
comma
(
print_expr
info
))
el
|
Etup
el
->
fprintf
fmt
"(%a)"
(
print_list
comma
(
print_expr
info
))
el
|
Eenum
(
rs
,
[]
)
->
print_uident
info
fmt
(
struct_id
rs
)
|
Eenum
(
rs
,
[]
)
->
print_uident
info
fmt
(
struct_id
rs
)
|
Eenum
(
rs
,
el
)
->
|
Eenum
(
rs
,
el
)
->
...
@@ -770,7 +778,7 @@ module Print = struct
...
@@ -770,7 +778,7 @@ module Print = struct
(
print_list
comma
(
print_expr
info
))
el
(
print_list
comma
(
print_expr
info
))
el
|
Estruct
(
rs
,
fl
,
el
)
->
|
Estruct
(
rs
,
fl
,
el
)
->
fprintf
fmt
"@[<hov 2>%a { %a }@]"
(
print_uident
info
)
(
struct_id
rs
)
fprintf
fmt
"@[<hov 2>%a { %a }@]"
(
print_uident
info
)
(
struct_id
rs
)
(
print_list2
semi
colon
(
print_rs
info
)
(
print_expr
info
))
(
fl
,
el
)
(
print_list2
comma
colon
(
print_rs
info
)
(
print_expr
info
))
(
fl
,
el
)
|
Eblock
el
->
|
Eblock
el
->
fprintf
fmt
"@[<hov 2>{@
\n
%a@]@
\n
}"
(
print_list
semi
(
print_expr
info
))
el
fprintf
fmt
"@[<hov 2>{@
\n
%a@]@
\n
}"
(
print_list
semi
(
print_expr
info
))
el
|
Ecall
(
rs
,
el
)
->
|
Ecall
(
rs
,
el
)
->
...
...
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