KipperDriver.mesa
Copied from Tran5Driver on October 21, 1985 10:54:50 am PDT
Sturgis, May 20, 1986 2:53:54 pm PDT
DIRECTORY
Commander USING[CommandProc, Register],
IO USING[CharClass, Close, EndOfStream, GetTokenRope, IDProc, RIS, STREAM],
FS USING[StreamOpen],
OneCasabaParser USING[GetReportStream],
KipperCentralDef USING[ParseOneStream],
KipperCodeGen USING[BuildFilesFromContext, PrintTypeNodeContext],
KipperMain1Def USING[ModuleBodyNode, TypeContextNode],
Rope USING[Cat, ROPE];
KipperDriver: CEDAR MONITOR
IMPORTS Commander, FS, IO, KipperCentralDef, KipperCodeGen, OneCasabaParser, Rope =
BEGIN OPEN Commander, IO, Rope;
debugFlags: CARDINAL ← 0;
printContext: BOOLEAN ← FALSE;
TestKipper: CommandProc =
BEGIN
commandLineStream: STREAMRIS[cmd.commandLine];
errorFlag: BOOLEAN ← FALSE;
rootName: ROPE;
sourceStream: STREAM;
root: KipperMain1Def.ModuleBodyNode;
context: KipperMain1Def.TypeContextNode;
rootName ← GetTokenRope[commandLineStream, IDProc
! EndOfStream => {rootName ← NIL; CONTINUE}].token;
Close[commandLineStream];
sourceStream ← FS.StreamOpen[Rope.Cat[rootName, ".Kipper"]];
root ← NARROW[KipperCentralDef.ParseOneStream[sourceStream, debugFlags, cmd.out
! OneCasabaParser.GetReportStream => {errorFlag ← TRUE; RESUME[cmd.out]}]];
Close[sourceStream];
IF errorFlag THEN RETURN;
context ← root.procs.FormContext[root];
IF printContext THEN KipperCodeGen.PrintTypeNodeContext[context, cmd.out];
KipperCodeGen.BuildFilesFromContext[context, cmd.out];
END;
main code
Register["///Commands/Kipper", TestKipper];
END..