|
| 1 | + ===================================================================== |
| 2 | + |
| 3 | + ---------- Mini-Scheme Interpreter Version 0.85 ---------- |
| 4 | + |
| 5 | + coded by Atsushi Moriwaki (11/5/1989) |
| 6 | + |
| 7 | + E-MAIL : moriwaki@kurims.kurims.kyoto-u.ac.jp |
| 8 | + MIX : riemann |
| 9 | + NIFTY : PBB01074 |
| 10 | + (Note that these addresses are now obsolete, see below) |
| 11 | + |
| 12 | + ===================================================================== |
| 13 | + |
| 14 | +Revised by Akira KIDA |
| 15 | + |
| 16 | +Version 0.85k4 (17 May 1994) |
| 17 | +Version 0.85k3 (30 Nov 1989) |
| 18 | +Version 0.85k2 (28 Nov 1989) |
| 19 | +Version 0.85k1 (14 Nov 1989) |
| 20 | + |
| 21 | +Mini-Scheme is now maintained by Akira KIDA. |
| 22 | + |
| 23 | +E-Mail : SDI00379@niftyserve.or.jp |
| 24 | + |
| 25 | +Most part of this document is written by Akira KIDA. |
| 26 | +Send comments/requests/bug reports to Akira KIDA at the above |
| 27 | +email address. |
| 28 | + |
| 29 | + ===================================================================== |
| 30 | + |
| 31 | + This Mini-Scheme Interpreter is based on "SCHEME Interpreter in |
| 32 | + Common Lisp" in Appendix of T.Matsuda & K.Saigo, Programming of LISP, |
| 33 | + archive No5 (1987) p6 - p42 (published in Japan). |
| 34 | + |
| 35 | + |
| 36 | + Copyright Notice: |
| 37 | +THIS SOFTWARE IS PLACED IN THE PUBLIC DOMAIN BY THE AUTHOR. |
| 38 | + |
| 39 | + This software is completely free to copy, modify and/or re-distribute. |
| 40 | + But I (Atsushi Moriwaki) would appreciate it if you left my name on the |
| 41 | + code as the author. |
| 42 | + |
| 43 | + DISCLAIMER: |
| 44 | + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 45 | + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 46 | + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 47 | + PURPOSE. |
| 48 | + |
| 49 | + |
| 50 | + Supported features (or, NOT supported features :-) |
| 51 | +1) Lists, symbols, strings. |
| 52 | + However, strings have very limited capability. |
| 53 | + For instance, there is *NO* string-ref, string-set!, ... etc. |
| 54 | +2) Numbers are limited to FIXNUM only. |
| 55 | + There is *NO* complex, real, rational and even bignum. |
| 56 | +3) Macro feature is supported, though not the one defined in R4RS. |
| 57 | + |
| 58 | + Known problems: |
| 59 | +1) Poor error recovery from illegal use of syntax and procedure. |
| 60 | +2) Certain procedures do not check its argument type. |
| 61 | + |
| 62 | + Installation: |
| 63 | +1) Select system declaration and configuration options by editing |
| 64 | + source file. |
| 65 | + |
| 66 | + You may choose one of the following systems by #define'ing |
| 67 | + the preprocessor symbol. |
| 68 | + |
| 69 | + Supported systems are: |
| 70 | + Macintosh: |
| 71 | +LSC -- LightSpeed C (3.0) for Macintosh |
| 72 | +LSC4 -- LightSpeed C (4.0) for Macintosh |
| 73 | + They are different in #include header only. |
| 74 | + I (kida) think THINK C 5.0, 6.0, 7.0 may be OK |
| 75 | + with LSC4 configuration, though not tested. |
| 76 | +MPW2 -- Macintosh Programmer's Workshop v2.0x |
| 77 | + I don't tested v3.x or later. |
| 78 | + DOS: |
| 79 | +MSC4 -- Microsoft C v4.0 (use /AL) |
| 80 | + MSC v5.1, v6.0, v7.0 are all OK. |
| 81 | +TURBO2 -- Bolarnd's Turbo C v2.0 (use -ml) |
| 82 | + Turbo C++ 1.0 is OK. |
| 83 | + UNIX: |
| 84 | +BSD -- UNIX of BSD flavor, ex. SuOS 4.x |
| 85 | +SYSV -- UNIX of System-V flavor, ex. Sun/Solaris 2.x |
| 86 | + |
| 87 | + VAX/VMS: |
| 88 | +VAXC -- VAX-C v3.x (this symbol may be defined by the |
| 89 | + compiler automatically). |
| 90 | + |
| 91 | +2) Configure some preprocessor symbols by editing source files. |
| 92 | + |
| 93 | + Configurable #define's are: |
| 94 | + |
| 95 | +#define VERBOSE |
| 96 | +-- if defined, GC messages is verbose on default. |
| 97 | + |
| 98 | +#define AVOID_HACK_LOOP |
| 99 | +-- if defined, do _NOT_ use loop construction in the |
| 100 | + form |
| 101 | +do { ... } while (0) |
| 102 | + This form is used in macro expansion, since this is |
| 103 | + the best "safety" blocking construct when used in |
| 104 | + macro definition. |
| 105 | + However, some compiler (including SunPRO CC 2.0.1) |
| 106 | + is silly enough to warning this construct, like |
| 107 | + "warning: end-of-loop code not reached", etc. |
| 108 | + If you dislike such warning, please define this symbol. |
| 109 | + NOTE: You may get some "statement not reached" warning |
| 110 | + even if you have define this symbol. Please be patient, |
| 111 | + or, use more smart compiler. |
| 112 | + In short if you use GCC, undefine this and forget it |
| 113 | + at all. |
| 114 | + |
| 115 | +#define USE_SETJMP |
| 116 | +-- if defined, use setjmp to global jump on error. |
| 117 | + if not defined, avoid to use it. Compiled with |
| 118 | + this symbol defined, the interpreter issue fatal |
| 119 | + error and return to the operating system immediately |
| 120 | + when we run out of free cells. By default, i.e., |
| 121 | + compiled with this symbol is not defined, the |
| 122 | + interpreter will just return to the top level in |
| 123 | + such a case. |
| 124 | + May not be used except for compiling as Mac DA. |
| 125 | + |
| 126 | +#define USE_MACRO |
| 127 | +-- if defined, macro features are enabled. |
| 128 | + |
| 129 | +#define USE_QQUOTE |
| 130 | +-- if defined, you can use quasi-quote "`" in macro. |
| 131 | + You can use macro even if this symbol is undefined. |
| 132 | + |
| 133 | +3) Compile! |
| 134 | + |
| 135 | + I think there is virtually no problem about how to compile. |
| 136 | + Since there is exactly one C source file. :-) |
| 137 | + If you are on UNIX boxes with some BSD flavors, instead of |
| 138 | + using make command, it's enough to type: |
| 139 | + |
| 140 | +cc -DBSD -O -o miniscm miniscm.c |
| 141 | + |
| 142 | + You may have additional warnings like 'function should |
| 143 | + return value'. This is due to omitting 'void' keyword |
| 144 | + from the source in order to get pre-ANSI compatibility. |
| 145 | + |
| 146 | + |
| 147 | + Usage : miniscm |
| 148 | + |
| 149 | +Sorry, no command line argnumet is allowed. |
| 150 | + |
| 151 | + |
| 152 | + Special procedures of this system: |
| 153 | + |
| 154 | + gc : (gc) -- force garbage collection |
| 155 | + |
| 156 | + gc-verbose : (gc-verbose bool) -- GC verbose on/off |
| 157 | +Argument #f turnes off the GC message. |
| 158 | +Enything else turn on the GC message. |
| 159 | + |
| 160 | + quit : (quit) -- quit to the operating system |
| 161 | + |
| 162 | + put : (put sym prop expr) |
| 163 | + -- set the value of a property of a symbol. |
| 164 | + get : (get sym prop) |
| 165 | + -- get the value of a property of a symbol. |
| 166 | + |
| 167 | + new-segment : (new-segment n) |
| 168 | + -- allocate n new cell segments. |
| 169 | + |
| 170 | + print-width : (print-width list) |
| 171 | + -- returns 'printed' width of list. |
| 172 | + |
| 173 | + closure? : (closure? obj) |
| 174 | + -- test if obj is a closure or not. |
| 175 | + |
| 176 | + macro? : (macro? obj) |
| 177 | + -- test if obj is a macro or not. |
| 178 | + note that a macro is also a closure. |
| 179 | + |
| 180 | + get-closure-code |
| 181 | + : (get-closure-code closure-obj) |
| 182 | + -- extract S-expr from closure-obj. |
| 183 | + |
| 184 | + Scheme files: |
| 185 | + init.scm -- Automatically loaded at invocation. |
| 186 | + Default setting assumes that this file is in the current |
| 187 | + working directory. |
| 188 | + Change #define InitFile if you don't like it. |
| 189 | + |
| 190 | + tools.scm -- This is a sample file. Contains very tiny pretty-print |
| 191 | + procedure. |
| 192 | + After invoking miniscm, type: |
| 193 | +(load "tools.scm") |
| 194 | + and try |
| 195 | +(pp getd) |
| 196 | +(pp do) |
| 197 | + |
| 198 | + Documents?: |
| 199 | + |
| 200 | + Sorry, there is no other documents. |
| 201 | + Do not ask one for me, please see the source instead. :-) |
| 202 | + |
| 203 | + But if you _absolutely_ need help, please email to me at: |
| 204 | +<SDI00379@niftyserve.or.jp> |
| 205 | + |
| 206 | + Enjoy! |
| 207 | + |
| 208 | + -- Akira KIDA |
| 209 | +Sysop for FPL in NIFTY-Serve in JAPAN. |
| 210 | +(FPL stands for 'Forum for Program-Language') |
| 211 | + |
0 commit comments