DIRECTORY BasicTime USING [GMT], Commander USING [CommandProc, Register], NPGSCommandUtil USING [PairList, Echo, Failed, ParseCommand], IO USING [PutChar, PutF, PutRope, RIS, time], Loader USING [BCDBuildTime], NPGSOps USING [NPGSPhase, Generate, LockedSource, NoSource, BadSemantics], Rope USING [ROPE]; NPGSInterface: CEDAR PROGRAM IMPORTS Commander, NPGSCommandUtil, IO, Loader, NPGSOps = { buildTime: BasicTime.GMT ~ Loader.BCDBuildTime[Main]; Main: Commander.CommandProc = { source: Rope.ROPE; ok, warnings: BOOL; switches: Rope.ROPE; args, results: NPGSCommandUtil.PairList; StartPhase: PROC [phase: NPGSOps.NPGSPhase] 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 7.0 NPGS of %g\n", IO.time[buildTime]]; BEGIN [source, args, results, switches] _ NPGSCommandUtil.ParseCommand[s: IO.RIS[cmd.commandLine] ! NPGSCommandUtil.Failed => GO TO badSyntax]; cmd.out.PutRope["NPGS: "]; NPGSCommandUtil.Echo[cmd.out, source, args, results, switches]; IF source = NIL THEN GO TO noOp; cmd.out.PutRope["\n "]; [ok, warnings] _ NPGSOps.Generate[source, args, results, switches, StartPhase, TRUE ! NPGSOps.NoSource => GO TO noSource; NPGSOps.LockedSource => GO TO lockedSource; NPGSOps.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[key: "NPGS", proc: Main, doc: "Parser generator system. Switches: -c => use CUSP extensions, -m => generate Mesa (vs. Cedar) source code"]; }. ” NPGSInterface.mesa Copyright Σ 1985, 1986, 1988 by Xerox Corporation. All rights reserved. Satterthwaite, October 16, 1985 4:01:31 pm PDT Maxwell, August 9, 1983 10:50 am Russ Atkinson (RRA) March 17, 1988 9:57:33 am PST Doug Wyatt, December 18, 1986 1:45:31 pm PST JKF February 6, 1989 12:12:29 pm PST PROC [cmd: Handle] RETURNS [result: REF _ NIL, msg: Rope.ROPE _ NIL]; set up command stream Κ™•NewlineDelimiter ™codešœ™KšœH™HKšΟy.™.Kš ™ K™1K™,K™$—K˜šΟk ˜ Kšœ žœžœ˜Kšœ žœ˜(Kšœžœ(˜=Kšžœžœžœ˜-Kšœžœ˜Kšœžœ=˜JKšœžœžœ˜K˜—šΟn œž ˜Kšžœžœ˜7Kšœ˜K˜Kšœžœ˜5K˜šŸœ˜Kš žœžœ žœžœ žœžœ™EKšœ žœ˜Kšœžœ˜Kšœžœ˜K˜(K˜š Ÿ œžœžœžœžœ˜Kšžœž˜Kšœ)˜)Kšœ%˜%Kšžœ ˜'—šœ˜K˜——Kšœ'žœ˜;K˜šœ™Kšž˜šœDžœžœ˜[Kšœžœžœ ˜-—K˜K˜?Kš žœ žœžœžœžœ˜ K˜K˜šœOž˜Sšœžœžœ ˜%Kšœžœžœ˜+Kšœžœžœ˜,K˜——Kšœ˜šœžœžœž˜ K˜#K˜Kšžœ˜%—šž˜Kšœžœ˜ K˜4K˜:K˜7K˜7—Kšžœ˜K˜Kšœ˜K˜K˜——Kšœž˜žK˜K˜K˜——…—Ά γ