-- File: ParseDclsImpl.mesa
-- Last edited by Neil Gunther, 30-Nov-87 13:43:44
-- The original file was (mysteriously) truncated at the first SELECTion arm of ProcessQueue.
-- According to ParseTables.grammar the first 60 productions [0..59] are missing.
DIRECTORY
PrintDclsDefs USING [PrintDeclarations, PrintFunctionHead, MergeAttributes],
PrintStmtsDefs USING [PrintStatement],
ParseDefs USING [Value, Value2, commentString, ParseStmts, ParseExpr1, ParseExpr2],
PrintingDefs USING [GetComment, PrintComments, OutCode],
Storage USING [FreeString],
TreesDefs USING [FreeTree, MakeNode],
ParseInterface USING [ActionEntry, ProductionInfo];
ParseDclsImpl: PROGRAM IMPORTS PrintingDefs, PrintStmtsDefs, PrintDclsDefs, ParseDefs, Storage, TreesDefs EXPORTS ParseDefs = BEGIN
-- Problems: (1) This doesn't parse the comma (,) operator.
-- (2) This doesn't parse typedef'ed type declarations.
-- global variables
temp: ParseDefs.Value;
temp2: ParseDefs.Value2;
atemp: LONG POINTER TO LONG STRING;
avtop: LONG POINTER TO LONG STRING;
-- local data base (supplied by parser)
q: LONG DESCRIPTOR FOR ARRAY OF ParseInterface.ActionEntry;
v: LONG DESCRIPTOR FOR ARRAY OF ParseDefs.Value;
v2: LONG DESCRIPTOR FOR ARRAY OF ParseDefs.Value2;
l: LONG DESCRIPTOR FOR ARRAY OF CARDINAL;
prodData: LONG DESCRIPTOR FOR ARRAY OF ParseInterface.ProductionInfo;
-- initialization/termination
AssignDescriptors: PUBLIC PROCEDURE [
qd: LONG DESCRIPTOR FOR ARRAY OF ParseInterface.ActionEntry,
vd: LONG DESCRIPTOR FOR ARRAY OF ParseDefs.Value,
v2d: LONG DESCRIPTOR FOR ARRAY OF ParseDefs.Value2,
ld: LONG DESCRIPTOR FOR ARRAY OF CARDINAL,
pp: LONG DESCRIPTOR FOR ARRAY OF ParseInterface.ProductionInfo] =
{ q ← qd; v ← vd; v2 ← v2d; l ← ld; prodData ← pp; };
-- the interpretation rules
ProcessQueue: PUBLIC PROCEDURE [qI, top: CARDINAL] = {
rule: [0..377B];
FOR i: CARDINAL IN [0..qI) DO
top ← top - q[i].tag.pLength + 1;
avtop ← @v[top];
atemp ← @temp;
rule ← prodData[q[i].transition].rule;
SELECT rule FROM
0 => -- TYPE: ParseInterface
-- TABLE: ParseTables EXPORTS: SELF
-- GOAL: goal
--TERMINALS:
-- FCON ICON NAME STRING
-- a