EDIFParsing2.Mesa
Spreitzer, February 22, 1986 7:07:41 pm PST
DIRECTORY EDIFAndCore, EDIFfing, IO, Rope;
EDIFParsing2: CEDAR DEFINITIONS = {OPEN EDIFAndCore, EDIFfing;
ParseError: ERROR [
parseStack: ParseStack,
Tells where you are in the parse tree.
nonTerminal: ATOM, syntaxRule: SyntaxRule
Tells where you are in the grammar.
];
ParseStack: TYPE = LIST OF ParseTreePlace;
ParseTreePlace: TYPE = RECORD [list: REF list ParseTreePrivate, index: INT];
Register: PROC [
outerKey: ATOMNIL,
key: ATOM,
start: PROC [outerKey, key: ATOM, name: NameStuff, outerConv: REF ANY] RETURNS [conv: REF ANY] ← NIL,
finish: PROC [conv: REF ANY] ← NIL,
rule: SyntaxRule
];
SyntaxRuleList: TYPE = LIST OF SyntaxRule;
SyntaxRule: TYPE = REF SyntaxRulePrivate;
SyntaxRulePrivate: TYPE = RECORD [
variant: SELECT type: SyntaxRuleType FROM
terminal => [vart: SELECT class: * FROM
any => [],
string => [],
identifier => [],
integer => [min, max: INT],
keyword => [key: ROPE],
ENDCASE],
nonTerminal => [category: ATOM],
choice => [choices: SyntaxRuleList],
repeat => [r: SyntaxRule, atLeastOnce: BOOL],
series => [elts: SyntaxRuleList],
optional => [r: SyntaxRule],
nest => [r: SyntaxRule],
atMostOne => [r: SyntaxRule],
cut => [],
ENDCASE
];
SyntaxRuleType: TYPE = {terminal, nonTerminal, choice, repeat, series, optional, nest, atMostOne, cut};
}.