-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME-hacking
104 lines (69 loc) · 3.15 KB
/
README-hacking
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
This README-hacking file describes the development environment.
Copyright (C) 2016 Marc Nieper-Wißkirchen
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
The development sources are available through git at GitLab:
https://gitlab.com/nieper/rapid-scheme
Autotools
---------
This distribution uses quite recent versions of the Autotools. Older
versions may work; please report success to the author.
Host Scheme system
------------------
As Rapid Scheme is written in Scheme code as described by R7RS, a
suitable implementation of the R7RS is needed. The configure scripts
distributed with the development sources assumes that a sufficiently
recent nightly build of Larceny is installed on the system, however
any other Scheme system that fully implements the R7RS should also
work. (Chibi Scheme has been proven to work, but it is several orders
of magnitude slower than Larceny.)
Building
--------
After installing Larceny (or any other implementation of the R7RS
after suitably patching the provided configuration files), you can run
./bootstrap
to do a fresh build. After that first time, running make should
suffice to build the two executables src/runtime/rapid-scheme and
src/compiler/rapid-compile.
Run tests
---------
You can run
make check
to execute the provided tests.
Compiling Scheme programs
-------------------------
You can run the program src/compiler/rapid-compile to expand Scheme
programs as described by the R7RS. You need to add the `-I
src/runtime/lib option' so that the standard library of the R7RS can
be found. The expanded program is written to stdout, and is
self-contained apart from a minimal runtime exported by (rapid
primitive).
Execute Scheme programs
-----------------------
You can run the program src/runtime/rapid-scheme to expand and
evaluate Scheme programs as described by the R7RS. You need to add
the `-I src/runtime/lib' option so that the standard library of the
R7RS can be found.
Compiler Front-end
-----------------
The compiler frontend reads text files containing Scheme programs and
library definitions, imports libraries and macro-expands the code.
The output of the frontend is a very restricted subset of R7RS code.
The main binding construct is letrec*-values.
Compiler Middle-end
-------------------
The middle-end consists of a number of passes executed in succession:
* lambda-lift: Procedures are hoisted as far as possible without
changing their signatures. All procedures become bound to
identifiers. The main binding construct is still letrec*-values.
* fix-letrec: The letrec*-values binding construct is rewritten
according to the algorithm described by Abdulaziz Ghuloum and Kent
Dybvig in "Fixing Letrec (reloaded)" extended to handle multiple
value bindings. The binding construct for procedure variables becomes
letrec. All other variables are bound by let-values. Multiple
assignments by set!-values are introduced in this pass.
Compiler Back-end
-----------------
The back-end simply writes the output of the middle-end as valid R7RS
code.