OneCasabaParserPrivate: CEDAR DEFINITIONS =
BEGIN OPEN IO, OneCasabaParser, Rope;
ParserTable: TYPE = REF ParserTableBody;
ParserTableBody: TYPE = RECORD[
unAnalyzedSymbols: SymbolCell ← NIL,
nSymbols: CARDINAL ← 0,
unAnalyzedTokens: TokenCell ← NIL,
nTokens: CARDINAL ← 0,
unAnalyzedActions: ActionCell ← NIL,
nActions: CARDINAL ← 0,
startState: State ← 0,
symbolTable: SymbolTable ← NIL,
tokenTable: TokenTable ← NIL,
actionTable: ActionTable ← NIL];
SymbolTable: TYPE = REF SymbolTableBody;
SymbolTableBody: TYPE = RECORD[
symbols: SEQUENCE nSlots: CARDINAL OF SymbolCell];
SymbolCell: TYPE = REF SymbolCellBody;
SymbolCellBody: TYPE = RECORD[
name: ROPE,
code: CARDINAL,
next: SymbolCell];
TokenTable: TYPE = REF TokenTableBody;
TokenTableBody: TYPE = RECORD[
idToken: TokenCell,
tokens: SEQUENCE nSlots: CARDINAL OF TokenCell];
TokenCell: TYPE = REF TokenCellBody;
TokenCellBody: TYPE = RECORD[
name: ROPE,
symbolCode: CARDINAL,
kind: TokenKind,
spelling: ROPE,
case: TokenCase,
next: TokenCell];
TokenCase: TYPE = {unique, generic};
ActionTable: TYPE = REF ActionTableBody;
ActionTableBody: TYPE = RECORD[
actions: SEQUENCE nSlots: CARDINAL OF ActionCell];
ActionCell: TYPE = REF ActionCellBody; -- not the most compact representation
ActionCellBody: TYPE = RECORD[
state: State,
terminal: CARDINAL, -- symbol code
action: Action,
nextState: State, -- for shifts
ruleNumber: CARDINAL, -- for reductions
leftSide: CARDINAL, -- symbol code for left side non terminal
ruleSize: CARDINAL, -- number of right side symbols
next: ActionCell];
Action: TYPE = {shift, reduce, accept};
END.