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
4397bfd4
Commit
4397bfd4
authored
Aug 19, 2016
by
Guillaume Melquiond
Browse files
Handle matching of boolean values in the interpreter.
parent
fdc992a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/whyml/mlw_interp.ml
View file @
4397bfd4
...
@@ -45,6 +45,8 @@ type value =
...
@@ -45,6 +45,8 @@ type value =
|
Vcase
of
value
*
term_branch
list
|
Vcase
of
value
*
term_branch
list
let
array_cons_ls
=
ref
ps_equ
let
array_cons_ls
=
ref
ps_equ
let
ls_true
=
ref
ps_equ
let
ls_false
=
ref
ps_equ
let
rec
print_value
fmt
v
=
let
rec
print_value
fmt
v
=
match
v
with
match
v
with
...
@@ -228,6 +230,9 @@ let rec matching env (t:value) p =
...
@@ -228,6 +230,9 @@ let rec matching env (t:value) p =
else
else
if
ls2
.
ls_constr
>
0
then
raise
NoMatch
if
ls2
.
ls_constr
>
0
then
raise
NoMatch
else
raise
Undetermined
else
raise
Undetermined
|
Vbool
b
->
let
l
=
if
b
then
!
ls_true
else
!
ls_false
in
if
ls_equal
ls1
l
then
env
else
raise
NoMatch
|
_
->
raise
Undetermined
|
_
->
raise
Undetermined
...
@@ -407,8 +412,8 @@ let eval_map_set ls_set l =
...
@@ -407,8 +412,8 @@ let eval_map_set ls_set l =
let
built_in_theories
=
let
built_in_theories
=
[
[
"bool"
]
,
"Bool"
,
[]
,
[
[
"bool"
]
,
"Bool"
,
[]
,
[
"True"
,
Non
e
,
eval_true
;
[
"True"
,
Some
ls_tru
e
,
eval_true
;
"False"
,
Non
e
,
eval_false
;
"False"
,
Some
ls_fals
e
,
eval_false
;
]
;
]
;
[
"int"
]
,
"Int"
,
[]
,
[
"int"
]
,
"Int"
,
[]
,
[
"infix +"
,
None
,
eval_int_op
BigInt
.
add
;
[
"infix +"
,
None
,
eval_int_op
BigInt
.
add
;
...
...
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