-
Notifications
You must be signed in to change notification settings - Fork 17
/
README
145 lines (114 loc) · 4.46 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
README (July 12, 1996)
This package contains the complete Scheme implementation of the
reflective language Black. For more details on Black, see [1].
The file black.tar.gz (or .Z) contains the following files:
README : this file
env.scm : environment manipulation functions
black.scm : the main body of Black
black-with-delta.scm
: same as black.scm except that it supports the
delta abstraction introduced in Blond[2].
int.scm : user observable metalevel interpreter
break.blk : a sample program which install two new special
forms: break and inspect.
compare : a simple shell script which compares black.scm
with int.scm (except for the insertion of meta-apply)
Since the implementation uses no special constructs except for
cons-stream and pp, it should run on almost any Scheme by typing:
(define scheme-apply apply)
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
Followings are the Scheme system on which we have tested our
implementation together with some specific definitions required:
Chez Scheme Version 5.0a:
(define head car)
(define (tail x) (force (cdr x)))
(define-syntax cons-stream
(syntax-rules ()
((cons-stream a b) (cons a (delay b)))))
(define scheme-apply apply)
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
To compile, you will have to include the definition of
cons-stream, so that it is properly compiled as a macro.
MIT-Scheme Version 7.3.0:
(define scheme-apply apply)
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
Gambit Scheme Version 2.2:
(define head car)
(define (tail x) (force (cdr x)))
(##define-macro (cons-stream a b)
`(cons ,a (delay ,b)))
(define scheme-apply apply)
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
To compile, you will have to include the definition of
cons-stream, so that it is properly compiled as a macro.
You will also have to declare:
(##declare (r4rs-scheme))
so that delay is compiled as a special form.
SCM Version 4e1:
(define head car)
(define (tail x) (force (cdr x)))
(define cons-stream
(procedure->macro
(lambda (x env)
(let ((a (cadr x))
(b (caddr x)))
`(cons ,a (delay ,b))))))
(define scheme-apply apply)
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
elk:
(define head car)
(define (tail x) (force (cdr x)))
(define-macro (cons-stream a b)
`(cons ,a (delay ,b)))
(autoload 'pp 'pp)
(define scheme-apply apply)
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
It seems that elk does not handle mutual tail recursion correctly.
Thus, stack overflow will eventually occur.
To quit Black, type an interrupt key. Black has no command to quit
the system. (exit 0) will merely exit the current level.
The extensions that are not described in the paper are as follows:
1. Special forms not described in the paper (cond, let, etc.) are
supported.
2. Special forms delay, force, cons-stream, and primitive-EM are
supported, so that the implementation is meta-circular. You can
execute Black on top of Black by typing the followings in Black:
(define head car)
(define (tail x) (force (cdr x)))
(load "env.scm")
(load "black.scm") or (load "black-with-delta.scm")
(black)
3. (if <bool> <then>) without <else> is supported.
4. The error "Wrong number of arguments" (for lambda closures) is
supported.
When errors such as "Unbound variables" and "Not a Function" occur,
the current level is properly terminated, and the control moves to the
upper level. However, some errors cause the Black system to stop.
Such errors include the ones occured in the application of primitives,
e.g., (car 0). To handle these errors, we have to check if the
application of primitives leads to an error every time a primitive is
applied. Because it would make the apply procedure much longer and
tedious, we do not remedy this but leave it as an alternative way to
quit the Black system.
For questions, comments, etc., contact [email protected].
References
[1] Kenichi Asai, Satoshi Matsuoka, and Akinori Yonezawa
"Duplication and Partial Evaluation
--- For a Better Understanding of Reflective Languages ---"
Lisp and Symbolic Computation, 9, pp.203-241, Kluwer Academic
Publishers, Boston (1996).
[2] Olivier Danvy and Karoline Malmkjaer
"Intensions and Extensions in a Reflective Tower"
Lisp and Functional Programming, pp.327-341 (1988).