<> <> <> <> <> <> DIRECTORY BasicTime USING [GMT], Commander USING [CommandProc, Register], CommandUtil USING [PairList, Echo, Failed, Parse], IO USING [PutChar, PutF, PutRope, RIS, time], Loader USING [BCDBuildTime], PGSOps USING [PGSPhase, Generate, LockedSource, NoSource, BadSemantics], Rope USING [ROPE]; PGSInterface: PROGRAM IMPORTS Commander, CommandUtil, IO, Loader, PGSOps = { <> <> <<[0, 0, 0, 0, 76b, 146b, 300b, 4300b, 76336b, 4304b, 314b, 164b, 0, 0, 0, 0]];>> <> <<[37000b, 63000b, 140000b, 140010b, 157174b, 142010b, 146000b, 72000b,>> <<0b, 177777b, 111111b, 177777b, 111111b, 177777b, 111111b, 177777b]];>> <<>> <<* * * * * * HERE IT BEGINS * * * * * *>> buildTime: BasicTime.GMT ~ Loader.BCDBuildTime[Main]; Main: Commander.CommandProc = TRUSTED { <> source: Rope.ROPE; ok, warnings: BOOL; switches: Rope.ROPE; args, results: CommandUtil.PairList; StartPhase: PROC [phase: PGSOps.PGSPhase] RETURNS [goOn: BOOL _ TRUE] = { SELECT phase FROM format => cmd.out.PutRope["format ... "]; lalr => cmd.out.PutRope["lalr ... "]; ENDCASE => cmd.out.PutRope["??? ... "]; }; cmd.out.PutF["Cedar 6.0 PGS of %g\n", IO.time[buildTime]]; <> BEGIN [source, args, results, switches] _ CommandUtil.Parse[s: IO.RIS[cmd.commandLine] ! CommandUtil.Failed => GO TO badSyntax]; cmd.out.PutRope["PGS: "]; CommandUtil.Echo[cmd.out, source, args, results, switches]; IF source = NIL THEN GO TO noOp; cmd.out.PutRope["\n "]; [ok, warnings] _ PGSOps.Generate[source, args, results, switches, StartPhase, TRUE ! PGSOps.NoSource => GO TO noSource; PGSOps.LockedSource => GO TO lockedSource; PGSOps.BadSemantics => GO TO badSemantics]; cmd.out.PutRope[" "]; cmd.out.PutRope[SELECT TRUE FROM ~ok => "Errors logged, bad output", warnings => "Warnings logged", ENDCASE => "Completed successfully"]; EXITS noOp => NULL; noSource => cmd.out.PutRope[" -- Cannot be opened"]; lockedSource => cmd.out.PutRope[" -- Cannot be modified"]; badSyntax => cmd.out.PutRope[" -- Unparsable command"]; badSemantics => cmd.out.PutRope[" -- Illegal command"]; END; cmd.out.PutChar['\n]; }; Commander.Register["PGS", Main, "Parser generator system."]; }.