Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alphaLib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
POTTIER Francois
alphaLib
Commits
a1185be3
Commit
a1185be3
authored
8 years ago
by
POTTIER Francois
Browse files
Options
Downloads
Patches
Plain Diff
Removed the [env] parameter of [InsideRecVisit].
parent
63ecb7a2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Unbound.ml
+15
-25
15 additions, 25 deletions
src/Unbound.ml
with
15 additions
and
25 deletions
src/Unbound.ml
+
15
−
25
View file @
a1185be3
type
'
env
mode
=
|
OutsideRec
|
OutsideRec
(* updating [current] and visiting [outer] subterms *)
|
InsideRecDiscovery
(* updating [current] and doing nothing else; embedded subterms not visited *)
|
InsideRecVisit
of
'
env
(* [inner] component now known
; embedded subterms visited *)
|
InsideRecVisit
(* [current] not updated; [inner] is [current]
; embedded subterms visited *)
|
Repeated
type
'
env
penv
=
{
...
...
@@ -29,10 +29,8 @@ type ('p, 't) bind =
((
'
p
,
'
t
outer
)
rebind
)
abstraction
(* = 'p * 't *)
(* [Abstraction] allowed only in an expression *)
(* [Rebind], [Rec] forbidden under [Rec] *)
(* [Outer], [Binder] allowed both outside and inside [Rec] *)
(* [Inner] allowed only under [Rec]. *)
(* [Repeated] allowed everywhere *)
(* [Rebind], [Rec] forbidden under [Rec] and [Repeated] *)
(* [Outer], [Inner], [Binder], [Repeated] allowed everywhere *)
type
'
t
inner
=
'
t
...
...
@@ -58,7 +56,7 @@ class virtual ['self] libmap = object (self : 'self)
=
fun
visit_t
penv
t1
->
match
penv
.
mode
with
|
OutsideRec
|
InsideRecVisit
_
|
InsideRecVisit
|
Repeated
->
visit_t
penv
.
outer
t1
|
InsideRecDiscovery
->
...
...
@@ -77,15 +75,11 @@ class virtual ['self] libmap = object (self : 'self)
let
x2
,
env
=
self
#
extend
x1
env
in
current
:=
env
;
x2
|
Repeated
->
let
current
=
penv
.
current
in
let
env
=
!
current
in
self
#
lookup
x1
env
|
InsideRecVisit
env
->
assert
(
env
==
!
(
penv
.
current
));
(* TEMPORARY if always true, then we do not need to carry [env] *)
|
Repeated
|
InsideRecVisit
->
(* The environment should not be extended when in visit mode.
It has been extended already during the discovery phase. *)
self
#
lookup
env
x1
self
#
lookup
x1
!
(
penv
.
current
)
method
private
visit_rebind
:
'
env
'
p1
'
p2
'
q1
'
q2
.
(
'
env
penv
->
'
p1
->
'
p2
)
->
...
...
@@ -101,7 +95,7 @@ class virtual ['self] libmap = object (self : 'self)
let
q2
=
visit_q
penv
q1
in
p2
,
q2
|
InsideRecDiscovery
|
InsideRecVisit
_
|
InsideRecVisit
|
Repeated
->
(* [rebind] forbidden under [rec] and [repeated] *)
assert
false
...
...
@@ -123,15 +117,11 @@ class virtual ['self] libmap = object (self : 'self)
'
env
penv
->
'
t1
inner
->
'
t2
inner
=
fun
visit_t
penv
t1
->
match
penv
.
mode
with
|
OutsideRec
->
(* [inner] allowed only under [rec] *)
assert
false
|
InsideRecDiscovery
->
(* An [inner] subterm is NOT visited in discovery mode. *)
Obj
.
magic
()
|
InsideRecVisit
env
->
assert
(
env
==
!
(
penv
.
current
));
visit_t
env
t1
|
OutsideRec
|
InsideRecVisit
|
Repeated
->
visit_t
!
(
penv
.
current
)
t1
...
...
@@ -146,12 +136,12 @@ class virtual ['self] libmap = object (self : 'self)
let
penv
=
{
penv
with
mode
=
InsideRecDiscovery
}
in
let
_
=
visit_p
penv
p1
in
(* [!current] becomes [inner] *)
let
penv
=
{
penv
with
mode
=
InsideRecVisit
!
(
penv
.
current
)
}
in
let
penv
=
{
penv
with
mode
=
InsideRecVisit
}
in
visit_p
penv
p1
|
InsideRecDiscovery
|
InsideRecVisit
_
|
InsideRecVisit
|
Repeated
->
(* [rec]
not allowed
under [rec] or [repeated] *)
(* [rec]
forbidden
under [rec] or [repeated] *)
assert
false
method
private
visit_repeated
:
'
env
'
p1
'
p2
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment