Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Why3
why3
Commits
f7ce2151
Commit
f7ce2151
authored
Sep 25, 2013
by
MARCHE Claude
Browse files
Interp: debug array support
parent
fbb9491a
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/whyml/mlw_interp.ml
View file @
f7ce2151
...
...
@@ -329,6 +329,8 @@ let exec_array_get _env _spec s args =
|
_
->
assert
false
in
let
t
=
eval_map_get
(
Some
ty
)
!
ls_map_get
[
m
;
i
]
in
eprintf
"[interp] t[%a] -> %a@."
Pretty
.
print_term
i
Pretty
.
print_term
t
;
Normal
t
,
s
|
_
->
assert
false
end
...
...
@@ -362,6 +364,8 @@ let exec_array_set env spec s args =
with
Not_found
->
reg
in
let
s'
=
Mreg
.
add
reg
t
s
in
eprintf
"[interp] t[%a] <- %a@."
Pretty
.
print_term
i
Pretty
.
print_term
v
;
Normal
(
Mlw_expr
.
t_void
)
,
s'
|
_
->
assert
false
end
...
...
tests/test_exec.mlw
View file @
f7ce2151
...
...
@@ -158,6 +158,11 @@ module Array
with Found i -> i
end
let incr (t:array int) : unit =
for i=0 to t.length - 1 do
t[i] <- t[i]+1
done
let test0 () = let t = Array.make 2 21 in t[0]+t[1]
let test1 () =
...
...
@@ -178,19 +183,12 @@ module Array
t[2] <- 67;
t
let tbis () = t ()
let t0 () =
let t = Array.make 3 0 in
t[0] <- 12;
t[1] <- 42;
t[2] <- 67;
t[0] + t[1] + t[2] (* 121 *)
let t1 () =
let t = t () in
t[0] + t[1] + t[2] (* 121 *)
let i () = incr (t ())
let test12 () = search (t ()) 12
let test42 () = search (t ()) 42
let test67 () = search (t ()) 67
...
...
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