Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
71c094b0
Commit
71c094b0
authored
May 13, 2014
by
Julien Lopez
Browse files
Add a fresh variable for every pattern now, except for Constr (ok(?))
and Cap (to fix)
parent
efc1380c
Changes
1
Hide whitespace changes
Inline
Side-by-side
compile/compile.ml
View file @
71c094b0
...
...
@@ -177,13 +177,13 @@ and compile_branches env (brs : Typed.branches) =
(* p_i / t_i -> br.Typed.br_pat / br.Typed.br_type
* p_i / t_i is used here to add elements to env.gamma *)
and
compile_branch
env
br
=
(* We add a fresh variable "pat
:
<nb>
" if the pattern is more than a variable
or a constant
*)
(* We add a fresh variable "pat<nb>
:x" for each pattern
TODO: Add a fresh variable for cap too.
*)
let
t
,
_
,
d
=
br
.
Typed
.
br_pat
.
Patterns
.
descr
in
let
fv
=
match
d
with
|
Patterns
.
Times
(
_
)
->
incr
Patterns
.
counter
;
(
Patterns
.
fv
br
.
Typed
.
br_pat
)
@
[
!
Patterns
.
counter
,
"pat"
^
(
string_of_int
!
Patterns
.
counter
)
^
":x"
]
|
_
->
Patterns
.
fv
br
.
Typed
.
br_pat
in
|
Patterns
.
Constr
(
_
)
|
Patterns
.
Cap
(
_
)
->
Patterns
.
fv
br
.
Typed
.
br_pat
|
_
->
incr
Patterns
.
counter
;
(
Patterns
.
fv
br
.
Typed
.
br_pat
)
@
[
!
Patterns
.
counter
,
"pat"
^
(
string_of_int
!
Patterns
.
counter
)
^
":x"
]
in
let
pat
=
{
br
.
Typed
.
br_pat
with
Patterns
.
descr
=
(
t
,
fv
,
d
);
Patterns
.
fv
=
fv
}
in
let
env
=
List
.
fold_left
enter_local
env
fv
in
let
m
=
Patterns
.
filter
(
Types
.
descr
(
Patterns
.
accept
pat
))
pat
in
...
...
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