Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Why3
why3
Commits
c1491413
Commit
c1491413
authored
Jan 12, 2014
by
MARCHE Claude
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redesign mlw interp in progress
parent
4b850225
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
350 additions
and
185 deletions
+350
-185
src/ide/gmain.ml
src/ide/gmain.ml
+1
-1
src/main.ml
src/main.ml
+1
-1
src/whyml/mlw_interp.ml
src/whyml/mlw_interp.ml
+328
-181
src/whyml/mlw_interp.mli
src/whyml/mlw_interp.mli
+5
-1
tests/test_exec.mlw
tests/test_exec.mlw
+15
-1
No files found.
src/ide/gmain.ml
View file @
c1491413
...
...
@@ -1582,7 +1582,7 @@ let eval const result =
Mlw_interp
.
eval_global_term
e
.
S
.
env
th
.
Theory
.
th_known
t
in
Pp
.
sprintf
"@[<hov 2>%a@]"
Pretty
.
print_
term
t
Pp
.
sprintf
"@[<hov 2>%a@]"
Mlw_interp
.
print_
value
t
|
_
->
Pp
.
sprintf
"Symbol '%s' is not a constant in theory '%s.%s'"
...
...
src/main.ml
View file @
c1491413
...
...
@@ -532,7 +532,7 @@ let do_theory env drv fname tname th glist elist =
match
l
with
|
[]
->
let
t
=
Mlw_interp
.
eval_global_term
env
th
.
th_known
t
in
printf
"@[<hov 2>Evaluation of %s:@ %a@]@."
x
Pretty
.
print_
term
t
printf
"@[<hov 2>Evaluation of %s:@ %a@]@."
x
Mlw_interp
.
print_
value
t
|
_
->
eprintf
"Symbol '%s' is not a constant in theory '%s'.@."
x
tname
;
exit
1
...
...
src/whyml/mlw_interp.ml
View file @
c1491413
This diff is collapsed.
Click to expand it.
src/whyml/mlw_interp.mli
View file @
c1491413
...
...
@@ -11,7 +11,11 @@
(* WhyML interpretation *)
val
eval_global_term
:
Env
.
env
->
Decl
.
known_map
->
Term
.
term
->
Term
.
term
type
value
val
print_value
:
Format
.
formatter
->
value
->
unit
val
eval_global_term
:
Env
.
env
->
Decl
.
known_map
->
Term
.
term
->
value
type
result
...
...
tests/test_exec.mlw
View file @
c1491413
...
...
@@ -107,7 +107,7 @@ module Mut
x.i <- y.i;
y.i <- 4 * y.i + tmp;
sum.i <- sum.i + tmp
done;
done;
sum.i
let run1 () = f 10 (* should be 10 *)
...
...
@@ -145,6 +145,20 @@ module Ref
let run2 () = f 4000000 (* should be 4613732 *)
let g () : int =
for i=1 to 10 do
let x = ref i in
x := !x + 1
done;
42
let rec h n : int =
let x = ref 0 in
x := !x + 1;
if n = 0 then 0 else h (n-1) + !x
let hh () = h 10
end
...
...
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