OneCasabaParserDataImpl.Mesa
Copyright Ó 1988 by Xerox Corporation. All rights reserved.
Bill Jackson (bj) November 13, 1988 10:42:21 pm PST
DIRECTORY
KipperSupport USING [ UnKipperer, UnKipperRef, UnKipperRope, RecordUnKipperedRef, Kipperer, KipperRope, KipperRef ],
Basics USING [ RawBytes ],
IO USING [ STREAM, UnsafeGetBlock, UnsafePutBlock ],
OneCasabaParserData USING [],
OneCasabaParserPrivate USING [ TokenTable, TokenCellBody, ParserTable, ParserTableBody, TokenTableBody, ActionTable, ActionTableBody, SymbolTable, SymbolTableBody, ActionCell, SymbolCell, TokenCell, ActionCellBody, SymbolCellBody ],
Rope USING [ ROPE ];
OneCasabaParserDataImpl: CEDAR PROGRAM
IMPORTS KipperSupport, IO
EXPORTS OneCasabaParserData = {
OPEN Basics, IO, KipperSupport, OneCasabaParserPrivate, Rope;
RawBytes: PROC [ local: POINTER ] RETURNS [ raw: LONG POINTER TO Basics.RawBytes ] ~
TRUSTED INLINE { raw ← LOOPHOLE[LONG[local], LONG POINTER TO Basics.RawBytes] };
InternalPut16: PROC [ k: Kipperer, ptr: LONG POINTER ] ~ TRUSTED INLINE {
k.stream.UnsafePutBlock[[RawBytes[ptr], 2, 2]]; -- magic here: dorado: 0, sparc: 2!
};
InternalGet16: PROC [ u: UnKipperer, ptr: POINTER ] ~ TRUSTED INLINE {
IF ( u.stream.UnsafeGetBlock[[RawBytes[ptr], 2, 2]] # 2 ) THEN ERROR;
};
KipperActionCellBodyRef: PUBLIC PROC [ kipperer: Kipperer,
ActionCellBodyRef: REF ActionCellBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF KipperRef[kipperer, ActionCellBodyRef] THEN {
InternalPut16[kipperer, @(ActionCellBodyRef.state)];
InternalPut16[kipperer, @(ActionCellBodyRef.terminal)];
word ← ORD[(ActionCellBodyRef.action)];
InternalPut16[kipperer, @(word)];
InternalPut16[kipperer, @(ActionCellBodyRef.nextState)];
InternalPut16[kipperer, @(ActionCellBodyRef.ruleNumber)];
InternalPut16[kipperer, @(ActionCellBodyRef.leftSide)];
InternalPut16[kipperer, @(ActionCellBodyRef.ruleSize)];
KipperActionCell[kipperer, (ActionCellBodyRef.next)];
};
};
UnKipperActionCellBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ ActionCellBodyRef: REF ActionCellBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[ActionCellBody];
RecordUnKipperedRef[unKipperer, refAny];
ActionCellBodyRef ← NARROW[refAny];
InternalGet16[unKipperer, @(ActionCellBodyRef.state)];
InternalGet16[unKipperer, @(ActionCellBodyRef.terminal)];
InternalGet16[unKipperer, @(word)];
(ActionCellBodyRef.action) ← VAL[word];
InternalGet16[unKipperer, @(ActionCellBodyRef.nextState)];
InternalGet16[unKipperer, @(ActionCellBodyRef.ruleNumber)];
InternalGet16[unKipperer, @(ActionCellBodyRef.leftSide)];
InternalGet16[unKipperer, @(ActionCellBodyRef.ruleSize)];
(ActionCellBodyRef.next) ← UnKipperActionCell[unKipperer];
}
ELSE ActionCellBodyRef ← NARROW[refAny];
};
KipperActionTableBodyRef: PUBLIC PROC [ kipperer: Kipperer,
ActionTableBodyRef: REF ActionTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, ActionTableBodyRef] ) THEN {
count: CARD16 ← ActionTableBodyRef.nSlots;
InternalPut16[kipperer, @(count)];
FOR i: CARD16 IN[0..(ActionTableBodyRef.nSlots)) DO
KipperActionCell[kipperer, (ActionTableBodyRef.actions[i])];
ENDLOOP;
};
};
UnKipperActionTableBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ] RETURNS [ ActionTableBodyRef: REF ActionTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
count: CARD16;
InternalGet16[unKipperer, @(count)];
refAny ← NEW[ActionTableBody[count]];
RecordUnKipperedRef[unKipperer, refAny];
ActionTableBodyRef ← NARROW[refAny];
FOR i: CARD16 IN[0..(ActionTableBodyRef.nSlots)) DO
(ActionTableBodyRef.actions[i]) ← UnKipperActionCell[unKipperer];
ENDLOOP;
}
ELSE ActionTableBodyRef ← NARROW[refAny];
};
KipperTokenCellBodyRef: PUBLIC PROC [ kipperer: Kipperer,
TokenCellBodyRef: REF TokenCellBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, TokenCellBodyRef] ) THEN {
KipperRope[kipperer, (TokenCellBodyRef.name)];
InternalPut16[kipperer, @(TokenCellBodyRef.symbolCode)];
word ← ORD[(TokenCellBodyRef.kind)];
InternalPut16[kipperer, @(word)];
KipperRope[kipperer, (TokenCellBodyRef.spelling)];
word ← ORD[(TokenCellBodyRef.case)];
InternalPut16[kipperer, @(word)];
KipperTokenCell[kipperer, (TokenCellBodyRef.next)];
};
};
UnKipperTokenCellBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ TokenCellBodyRef: REF TokenCellBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[TokenCellBody];
RecordUnKipperedRef[unKipperer, refAny];
TokenCellBodyRef ← NARROW[refAny];
(TokenCellBodyRef.name)← UnKipperRope[unKipperer];
InternalGet16[unKipperer, @(TokenCellBodyRef.symbolCode)];
InternalGet16[unKipperer, @(word)];
(TokenCellBodyRef.kind) ← VAL[word];
(TokenCellBodyRef.spelling)← UnKipperRope[unKipperer];
InternalGet16[unKipperer, @(word)];
(TokenCellBodyRef.case) ← VAL[word];
(TokenCellBodyRef.next) ← UnKipperTokenCell[unKipperer];
}
ELSE TokenCellBodyRef ← NARROW[refAny];
};
KipperTokenTableBodyRef: PUBLIC PROC [ kipperer: Kipperer,
TokenTableBodyRef: REF TokenTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, TokenTableBodyRef] ) THEN {
count: CARD16 ← TokenTableBodyRef.nSlots;
InternalPut16[kipperer, @(count)];
KipperTokenCell[kipperer, (TokenTableBodyRef.idToken)];
FOR i: CARD16 IN[0..(TokenTableBodyRef.nSlots)) DO
KipperTokenCell[kipperer, (TokenTableBodyRef.tokens[i])];
ENDLOOP;
};
};
UnKipperTokenTableBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ TokenTableBodyRef: REF TokenTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
count: CARD16;
InternalGet16[unKipperer, @(count)];
refAny ← NEW[TokenTableBody[count]];
RecordUnKipperedRef[unKipperer, refAny];
TokenTableBodyRef ← NARROW[refAny];
(TokenTableBodyRef.idToken) ← UnKipperTokenCell[unKipperer];
FOR i: CARD16 IN[0..(TokenTableBodyRef.nSlots)) DO
(TokenTableBodyRef.tokens[i]) ← UnKipperTokenCell[unKipperer];
ENDLOOP;
}
ELSE TokenTableBodyRef ← NARROW[refAny];
};
KipperSymbolCellBodyRef: PUBLIC PROC [ kipperer: Kipperer,
SymbolCellBodyRef: REF SymbolCellBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, SymbolCellBodyRef] ) THEN {
KipperRope[kipperer, (SymbolCellBodyRef.name)];
InternalPut16[kipperer, @(SymbolCellBodyRef.code)];
KipperSymbolCell[kipperer, (SymbolCellBodyRef.next)];
};
};
UnKipperSymbolCellBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ SymbolCellBodyRef: REF SymbolCellBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[SymbolCellBody];
RecordUnKipperedRef[unKipperer, refAny];
SymbolCellBodyRef ← NARROW[refAny];
(SymbolCellBodyRef.name)← UnKipperRope[unKipperer];
InternalGet16[unKipperer, @(SymbolCellBodyRef.code)];
(SymbolCellBodyRef.next) ← UnKipperSymbolCell[unKipperer];
}
ELSE SymbolCellBodyRef ← NARROW[refAny];
};
KipperSymbolTableBodyRef: PUBLIC PROC [ kipperer: Kipperer, SymbolTableBodyRef: REF SymbolTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, SymbolTableBodyRef] ) THEN {
count: CARD16 ← SymbolTableBodyRef.nSlots;
InternalPut16[kipperer, @(count)];
FOR i: CARD16 IN[0..(SymbolTableBodyRef.nSlots)) DO
KipperSymbolCell[kipperer, (SymbolTableBodyRef.symbols[i])];
ENDLOOP;
};
};
UnKipperSymbolTableBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ SymbolTableBodyRef: REF SymbolTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
count: CARD16;
InternalGet16[unKipperer, @(count)];
refAny ← NEW[SymbolTableBody[count]];
RecordUnKipperedRef[unKipperer, refAny];
SymbolTableBodyRef ← NARROW[refAny];
FOR i: CARD16 IN[0..(SymbolTableBodyRef.nSlots)) DO
(SymbolTableBodyRef.symbols[i]) ← UnKipperSymbolCell[unKipperer];
ENDLOOP;
}
ELSE SymbolTableBodyRef ← NARROW[refAny];
};
KipperParserTableBodyRef: PUBLIC PROC [ kipperer: Kipperer,
ParserTableBodyRef: REF ParserTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, ParserTableBodyRef] ) THEN {
KipperSymbolCell[kipperer, (ParserTableBodyRef.unAnalyzedSymbols)];
InternalPut16[kipperer, @(ParserTableBodyRef.nSymbols)];
KipperTokenCell[kipperer, (ParserTableBodyRef.unAnalyzedTokens)];
InternalPut16[kipperer, @(ParserTableBodyRef.nTokens)];
KipperActionCell[kipperer, (ParserTableBodyRef.unAnalyzedActions)];
InternalPut16[kipperer, @(ParserTableBodyRef.nActions)];
InternalPut16[kipperer, @(ParserTableBodyRef.startState)];
KipperSymbolTable[kipperer, (ParserTableBodyRef.symbolTable)];
KipperTokenTable[kipperer, (ParserTableBodyRef.tokenTable)];
KipperActionTable[kipperer, (ParserTableBodyRef.actionTable)];
};
};
UnKipperParserTableBodyRef: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ ParserTableBodyRef: REF ParserTableBody ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[ParserTableBody];
RecordUnKipperedRef[unKipperer, refAny];
ParserTableBodyRef ← NARROW[refAny];
(ParserTableBodyRef.unAnalyzedSymbols) ← UnKipperSymbolCell[unKipperer];
InternalGet16[unKipperer, @(ParserTableBodyRef.nSymbols)];
(ParserTableBodyRef.unAnalyzedTokens) ← UnKipperTokenCell[unKipperer];
InternalGet16[unKipperer, @(ParserTableBodyRef.nTokens)];
(ParserTableBodyRef.unAnalyzedActions) ← UnKipperActionCell[unKipperer];
InternalGet16[unKipperer, @(ParserTableBodyRef.nActions)];
InternalGet16[unKipperer, @(ParserTableBodyRef.startState)];
(ParserTableBodyRef.symbolTable) ← UnKipperSymbolTable[unKipperer];
(ParserTableBodyRef.tokenTable) ← UnKipperTokenTable[unKipperer];
(ParserTableBodyRef.actionTable) ← UnKipperActionTable[unKipperer];
}
ELSE ParserTableBodyRef ← NARROW[refAny];
};
KipperActionCell: PUBLIC PROC [ kipperer: Kipperer, ActionCellVal: ActionCell ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, ActionCellVal] ) THEN {
InternalPut16[kipperer, @(ActionCellVal.state)];
InternalPut16[kipperer, @(ActionCellVal.terminal)];
word ← ORD[(ActionCellVal.action)];
InternalPut16[kipperer, @(word)];
InternalPut16[kipperer, @(ActionCellVal.nextState)];
InternalPut16[kipperer, @(ActionCellVal.ruleNumber)];
InternalPut16[kipperer, @(ActionCellVal.leftSide)];
InternalPut16[kipperer, @(ActionCellVal.ruleSize)];
KipperActionCell[kipperer, (ActionCellVal.next)];
};
};
UnKipperActionCell: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ ActionCellVal: ActionCell ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[ActionCellBody];
RecordUnKipperedRef[unKipperer, refAny];
ActionCellVal ← NARROW[refAny];
InternalGet16[unKipperer, @(ActionCellVal.state)];
InternalGet16[unKipperer, @(ActionCellVal.terminal)];
InternalGet16[unKipperer, @(word)];
(ActionCellVal.action) ← VAL[word];
InternalGet16[unKipperer, @(ActionCellVal.nextState)];
InternalGet16[unKipperer, @(ActionCellVal.ruleNumber)];
InternalGet16[unKipperer, @(ActionCellVal.leftSide)];
InternalGet16[unKipperer, @(ActionCellVal.ruleSize)];
(ActionCellVal.next) ← UnKipperActionCell[unKipperer];
}
ELSE ActionCellVal ← NARROW[refAny];
};
KipperActionTable: PUBLIC PROC [ kipperer: Kipperer, ActionTableVal: ActionTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, ActionTableVal] ) THEN {
count: CARD16 ← ActionTableVal.nSlots;
InternalPut16[kipperer, @(count)];
FOR i: CARD16 IN[0..(ActionTableVal.nSlots)) DO
KipperActionCell[kipperer, (ActionTableVal.actions[i])];
ENDLOOP;
};
};
UnKipperActionTable: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ ActionTableVal: ActionTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
count: CARD16;
InternalGet16[unKipperer, @(count)];
refAny ← NEW[ActionTableBody[count]];
RecordUnKipperedRef[unKipperer, refAny];
ActionTableVal ← NARROW[refAny];
FOR i: CARD16 IN[0..(ActionTableVal.nSlots)) DO
(ActionTableVal.actions[i]) ← UnKipperActionCell[unKipperer];
ENDLOOP;
}
ELSE ActionTableVal ← NARROW[refAny];
};
KipperTokenCell: PUBLIC PROC [ kipperer: Kipperer, TokenCellVal: TokenCell ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, TokenCellVal] ) THEN {
KipperRope[kipperer, (TokenCellVal.name)];
InternalPut16[kipperer, @(TokenCellVal.symbolCode)];
word ← ORD[(TokenCellVal.kind)];
InternalPut16[kipperer, @(word)];
KipperRope[kipperer, (TokenCellVal.spelling)];
word ← ORD[(TokenCellVal.case)];
InternalPut16[kipperer, @(word)];
KipperTokenCell[kipperer, (TokenCellVal.next)];
};
};
UnKipperTokenCell: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ TokenCellVal: TokenCell ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[TokenCellBody];
RecordUnKipperedRef[unKipperer, refAny];
TokenCellVal ← NARROW[refAny];
(TokenCellVal.name)← UnKipperRope[unKipperer];
InternalGet16[unKipperer, @(TokenCellVal.symbolCode)];
InternalGet16[unKipperer, @(word)];
(TokenCellVal.kind) ← VAL[word];
(TokenCellVal.spelling)← UnKipperRope[unKipperer];
InternalGet16[unKipperer, @(word)];
(TokenCellVal.case) ← VAL[word];
(TokenCellVal.next) ← UnKipperTokenCell[unKipperer];
}
ELSE TokenCellVal ← NARROW[refAny];
};
KipperTokenTable: PUBLIC PROC [ kipperer: Kipperer, TokenTableVal: TokenTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, TokenTableVal] ) THEN {
count: CARD16 ← TokenTableVal.nSlots;
InternalPut16[kipperer, @(count)];
KipperTokenCell[kipperer, (TokenTableVal.idToken)];
FOR i: CARD16 IN[0..(TokenTableVal.nSlots)) DO
KipperTokenCell[kipperer, (TokenTableVal.tokens[i])];
ENDLOOP;
};
};
UnKipperTokenTable: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ TokenTableVal: TokenTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
count: CARD16;
InternalGet16[unKipperer, @(count)];
refAny ← NEW[TokenTableBody[count]];
RecordUnKipperedRef[unKipperer, refAny];
TokenTableVal ← NARROW[refAny];
(TokenTableVal.idToken) ← UnKipperTokenCell[unKipperer];
FOR i: CARD16 IN[0..(TokenTableVal.nSlots)) DO
(TokenTableVal.tokens[i]) ← UnKipperTokenCell[unKipperer];
ENDLOOP;
}
ELSE TokenTableVal ← NARROW[refAny];
};
KipperSymbolCell: PUBLIC PROC [ kipperer: Kipperer, SymbolCellVal: SymbolCell ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, SymbolCellVal] ) THEN {
KipperRope[kipperer, (SymbolCellVal.name)];
InternalPut16[kipperer, @(SymbolCellVal.code)];
KipperSymbolCell[kipperer, (SymbolCellVal.next)];
};
};
UnKipperSymbolCell: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ SymbolCellVal: SymbolCell ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[SymbolCellBody];
RecordUnKipperedRef[unKipperer, refAny];
SymbolCellVal ← NARROW[refAny];
(SymbolCellVal.name)← UnKipperRope[unKipperer];
InternalGet16[unKipperer, @(SymbolCellVal.code)];
(SymbolCellVal.next) ← UnKipperSymbolCell[unKipperer];
}
ELSE SymbolCellVal ← NARROW[refAny];
};
KipperSymbolTable: PUBLIC PROC [ kipperer: Kipperer, SymbolTableVal: SymbolTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, SymbolTableVal] ) THEN {
count: CARD16 ← SymbolTableVal.nSlots;
InternalPut16[kipperer, @(count)];
FOR i: CARD16 IN[0..(SymbolTableVal.nSlots)) DO
KipperSymbolCell[kipperer, (SymbolTableVal.symbols[i])];
ENDLOOP;
};
};
UnKipperSymbolTable: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ SymbolTableVal: SymbolTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
count: CARD16;
InternalGet16[unKipperer, @(count)];
refAny ← NEW[SymbolTableBody[count]];
RecordUnKipperedRef[unKipperer, refAny];
SymbolTableVal ← NARROW[refAny];
FOR i: CARD16 IN[0..(SymbolTableVal.nSlots)) DO
(SymbolTableVal.symbols[i]) ← UnKipperSymbolCell[unKipperer];
ENDLOOP;
}
ELSE SymbolTableVal ← NARROW[refAny];
};
KipperParserTable: PUBLIC PROC [ kipperer: Kipperer, ParserTableVal: ParserTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
IF ( KipperRef[kipperer, ParserTableVal] ) THEN {
KipperSymbolCell[kipperer, (ParserTableVal.unAnalyzedSymbols)];
InternalPut16[kipperer, @(ParserTableVal.nSymbols)];
KipperTokenCell[kipperer, (ParserTableVal.unAnalyzedTokens)];
InternalPut16[kipperer, @(ParserTableVal.nTokens)];
KipperActionCell[kipperer, (ParserTableVal.unAnalyzedActions)];
InternalPut16[kipperer, @(ParserTableVal.nActions)];
InternalPut16[kipperer, @(ParserTableVal.startState)];
KipperSymbolTable[kipperer, (ParserTableVal.symbolTable)];
KipperTokenTable[kipperer, (ParserTableVal.tokenTable)];
KipperActionTable[kipperer, (ParserTableVal.actionTable)];
};
};
UnKipperParserTable: PUBLIC PROC [ unKipperer: UnKipperer ]
RETURNS [ ParserTableVal: ParserTable ] ~ TRUSTED {
word: CARD16 ← 0;
doubleWord: CARD32 ← 0;
refAny: REFNIL;
flag: BOOLFALSE;
[flag, refAny] ← UnKipperRef[unKipperer];
IF ( flag )
THEN {
refAny ← NEW[ParserTableBody];
RecordUnKipperedRef[unKipperer, refAny];
ParserTableVal ← NARROW[refAny];
(ParserTableVal.unAnalyzedSymbols) ← UnKipperSymbolCell[unKipperer];
InternalGet16[unKipperer, @(ParserTableVal.nSymbols)];
(ParserTableVal.unAnalyzedTokens) ← UnKipperTokenCell[unKipperer];
InternalGet16[unKipperer, @(ParserTableVal.nTokens)];
(ParserTableVal.unAnalyzedActions) ← UnKipperActionCell[unKipperer];
InternalGet16[unKipperer, @(ParserTableVal.nActions)];
InternalGet16[unKipperer, @(ParserTableVal.startState)];
(ParserTableVal.symbolTable) ← UnKipperSymbolTable[unKipperer];
(ParserTableVal.tokenTable) ← UnKipperTokenTable[unKipperer];
(ParserTableVal.actionTable) ← UnKipperActionTable[unKipperer];
}
ELSE ParserTableVal ← NARROW[refAny];
};
}.