Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
why3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
125
Issues
125
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Why3
why3
Commits
7747ddde
Commit
7747ddde
authored
Sep 09, 2015
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try Why3: execution of main function in each module
parent
01c1e52a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
13 deletions
+40
-13
src/tools/why3execute.ml
src/tools/why3execute.ml
+2
-2
src/trywhy3/trywhy3.ml
src/trywhy3/trywhy3.ml
+29
-2
src/whyml/mlw_interp.ml
src/whyml/mlw_interp.ml
+7
-7
src/whyml/mlw_interp.mli
src/whyml/mlw_interp.mli
+2
-2
No files found.
src/tools/why3execute.ml
View file @
7747ddde
...
...
@@ -65,8 +65,8 @@ let do_input f =
exit
1
|
Some
d
->
try
printf
"@[<hov 2>Execution of %s.%s ():@
\n
"
mid
name
;
Mlw_interp
.
eval_global_symbol
env
m
d
;
printf
"@[<hov 2>Execution of %s.%s ():@
\n
%a"
mid
name
(
Mlw_interp
.
eval_global_symbol
env
m
)
d
with
e
when
Debug
.
test_noflag
Debug
.
stack_trace
->
printf
"@
\n
@]@."
;
raise
e
in
...
...
src/trywhy3/trywhy3.ml
View file @
7747ddde
...
...
@@ -156,8 +156,35 @@ let why3_execute (modules,_theories) =
Stdlib
.
Mstr
.
fold
(
fun
_k
m
acc
->
let
th
=
m
.
Mlw_module
.
mod_theory
in
let
name
=
th
.
Theory
.
th_name
.
Ident
.
id_string
in
[
Html
.
of_string
(
"Module "
^
name
)]
::
acc
)
let
modname
=
th
.
Theory
.
th_name
.
Ident
.
id_string
in
try
let
ps
=
Mlw_module
.
ns_find_ps
m
.
Mlw_module
.
mod_export
[
"main"
]
in
let
moduleans
=
Html
.
of_string
(
"Module "
^
modname
^
": "
)
in
let
ans
=
match
Mlw_decl
.
find_definition
m
.
Mlw_module
.
mod_known
ps
with
|
None
->
[
moduleans
;
Html
.
ul
[[
Html
.
of_string
"function main has no definition"
]]]
|
Some
d
->
try
[
moduleans
;
Html
.
ul
[[
Html
.
of_string
(
Pp
.
sprintf
"%a"
(
Mlw_interp
.
eval_global_symbol
env
m
)
d
)]]]
with
e
->
[
moduleans
;
Html
.
ul
[[
Html
.
of_string
(
Pp
.
sprintf
"exception during execution of function main : %a (%s)"
Exn_printer
.
exn_printer
e
(
Printexc
.
to_string
e
))]]]
in
ans
::
acc
with
Not_found
->
acc
)
modules
[]
in
Html
.
ul
mods
...
...
src/whyml/mlw_interp.ml
View file @
7747ddde
...
...
@@ -1373,7 +1373,7 @@ let eval_global_expr env mkm tkm _writes e =
let
eval_global_symbol
env
m
d
=
let
eval_global_symbol
env
m
fmt
d
=
let
lam
=
d
.
Mlw_expr
.
fun_lambda
in
match
lam
.
Mlw_expr
.
l_args
with
|
[
pvs
]
when
Mlw_ty
.
ity_equal
pvs
.
Mlw_ty
.
pv_ity
Mlw_ty
.
ity_unit
->
...
...
@@ -1382,7 +1382,7 @@ let eval_global_symbol env m d =
let
eff
=
spec
.
Mlw_ty
.
c_effect
in
let
writes
=
eff
.
Mlw_ty
.
eff_writes
in
let
body
=
lam
.
Mlw_expr
.
l_expr
in
printf
"@[<hov 2> type:@ %a@]@."
fprintf
fmt
"@[<hov 2> type:@ %a@]@."
Mlw_pretty
.
print_vty
body
.
Mlw_expr
.
e_vty
;
(* printf "effect: %a@\n" *)
(* Mlw_pretty.print_effect body.Mlw_expr.e_effect; *)
...
...
@@ -1393,26 +1393,26 @@ let eval_global_symbol env m d =
in
match
res
with
|
Normal
_
->
printf
"@[<hov 2> result:@ %a@
\n
globals:@ %a@]@."
fprintf
fmt
"@[<hov 2> result:@ %a@
\n
globals:@ %a@]@."
print_logic_result
res
print_vsenv
final_env
(*
printf
"@[<hov 2> result:@ %a@\nstate :@ %a@]@."
fprintf fmt
"@[<hov 2> result:@ %a@\nstate :@ %a@]@."
(print_result m.Mlw_module.mod_known
m.Mlw_module.mod_theory.Theory.th_known st) res
print_state st
*)
|
Excep
_
->
printf
"@[<hov 2>exceptional result:@ %a@
\n
globals:@ %a@]@."
fprintf
fmt
"@[<hov 2>exceptional result:@ %a@
\n
globals:@ %a@]@."
print_logic_result
res
print_vsenv
final_env
;
(*
printf
"@[<hov 2>exceptional result:@ %a@\nstate:@ %a@]@."
fprintf fmt
"@[<hov 2>exceptional result:@ %a@\nstate:@ %a@]@."
(print_result m.Mlw_module.mod_known
m.Mlw_module.mod_theory.Theory.th_known st) res
print_state st;
*)
exit
1
|
Irred
_
|
Fun
_
->
printf
"@
\n
@]@."
;
fprintf
fmt
"@
\n
@]@."
;
eprintf
"Execution error: %a@."
print_logic_result
res
;
exit
2
end
...
...
src/whyml/mlw_interp.mli
View file @
7747ddde
...
...
@@ -19,4 +19,4 @@ val eval_global_term:
Env
.
env
->
Decl
.
known_map
->
Term
.
term
->
value
val
eval_global_symbol
:
Env
.
env
->
Mlw_module
.
modul
->
Mlw_expr
.
fun_defn
->
unit
Env
.
env
->
Mlw_module
.
modul
->
Format
.
formatter
->
Mlw_expr
.
fun_defn
->
unit
Write
Preview
Markdown
is supported
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