SchemeLiteImpl.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Michael Plass, July 11, 1989 9:56:05 am PDT
Bootstrap loader for the Hobbit-compiled portions of the system.
DIRECTORY
IO USING [STREAM],
Rope,
Scheme,
SchemePrivate USING [ByteCodeTemplate, ProcedureFromByteCodeTemplate],
SchemeSys USING [FindFileToLoad];
SchemeLiteImpl: CEDAR PROGRAM
IMPORTS Scheme, SchemePrivate, SchemeSys
~ BEGIN OPEN Scheme, SchemePrivate;
ROPE: TYPE ~ Rope.ROPE;
Registration of Primitives
RegisterByteCodes: PROC [env: Environment] ~ {
initErrors: INT ¬ 0;
Inner: PROC [compiled: Any] ~ {
WITH compiled SELECT FROM
pair: Pair => {
WITH pair.car SELECT FROM
syntax: PrimitiveSyntax => {
IF syntax­ = begin THEN {
FOR tail: Any ¬ pair.cdr, Cdr[tail] UNTIL tail = NIL DO
Inner[Car[tail]];
ENDLOOP;
RETURN;
};
};
ENDCASE => NULL;
};
template: ByteCodeTemplate => {
proc: Procedure ~ ProcedureFromByteCodeTemplate[template, env];
[] ¬ Apply[proc, NIL];
RETURN;
};
ENDCASE => NULL;
initErrors ¬ initErrors + 1;
ERROR;
};
Inner[systemByteCodes];
};
Initalization
systemByteCodesName: ROPE = "Scheme.$cheme";
systemByteCodes: Any = ReadSystemByteCodes[];
ReadSystemByteCodes: PROC RETURNS [s: Any ¬ NIL] ~ {
Inner: PROC [port: IO.STREAM, doExpand: BOOL] ~ {
s ¬ Read[port];
};
SchemeSys.FindFileToLoad[systemByteCodesName, Inner];
};
RegisterInit[RegisterByteCodes];
END.