-- file PGSParseTable.mesa
-- created by PGS from PGSScan.mesa, October 25, 1985 9:33:52 am PDT

ParseTable: DEFINITIONS = {

  Symbol: TYPE = [0..255];
  TSymbol: TYPE = Symbol[0.. 19];
  NTSymbol: TYPE = Symbol[0.. 13];

-- token indices for the scanner and parser
  tokenID: TSymbol =  1;
  tokenNUM: TSymbol =  2;
  tokenQUERY: TSymbol =  3;
  tokenTAB3: TSymbol =  9;
  tokenTAB4: TSymbol = 10;
  initialSymbol: TSymbol =  3;

  defaultMarker: TSymbol = TSymbol.FIRST;
  endMarker: TSymbol = TSymbol.LAST;

  HashIndex: TYPE = [0.. 29];
  VIndex: TYPE = [0..106];

VocabHashEntry: TYPE = MACHINE DEPENDENT RECORD [
symbol(0: 0..7): TSymbol,	-- symbol index
link(0: 8..15): HashIndex];	-- link to next entry

  State: TYPE = [0.. 26];
  NTState: TYPE = State[0..  6];
  TIndex: TYPE = [0.. 64];
  NTIndex: TYPE = [0..  3];
  Production: TYPE = [0.. 37];

ActionTag: TYPE = MACHINE DEPENDENT RECORD [
reduce(0: 0..0): BOOL,   	-- TRUE iff reduce entry
pLength(0: 1..4): [0..15]];	-- number of symbols in production rhs
ActionEntry: TYPE = MACHINE DEPENDENT RECORD [
tag(0: 0..4): ActionTag,		-- [FALSE,0] if a shift entry
transition(0: 5..15): [0..2047]];	-- production number / next state

ProductionInfo: TYPE = MACHINE DEPENDENT RECORD [
rule(0: 0..7): [0..256),		-- reduction rule
lhs(0: 8..15): NTSymbol];	-- production lhs symbol

  ScanTable: TYPE = ARRAY CHAR['\040..'\177] OF TSymbol;
  HashTable: TYPE = ARRAY HashIndex OF VocabHashEntry;
  IndexTable: TYPE = ARRAY TSymbol OF CARDINAL;
  Vocabulary: TYPE = MACHINE DEPENDENT RECORD [
    length(0), maxlength(1): CARDINAL,
    text(2): PACKED ARRAY VIndex OF CHAR];
  ProdData: TYPE = ARRAY Production OF ProductionInfo;
  NStarts: TYPE = ARRAY NTState OF NTIndex;
  NLengths: TYPE = ARRAY NTState OF CARDINAL;
  NSymbols: TYPE = ARRAY NTIndex OF NTSymbol;
  NActions: TYPE = ARRAY NTIndex OF ActionEntry;
  NTDefaults: TYPE = ARRAY NTSymbol OF ActionEntry;
  TStarts: TYPE = ARRAY State OF TIndex;
  TLengths: TYPE = ARRAY State OF CARDINAL;
  TSymbols: TYPE = ARRAY TIndex OF TSymbol;
  TActions: TYPE = ARRAY TIndex OF ActionEntry;

  initialState: State = 1;
  finalState: State = 0;

Table: TYPE = MACHINE DEPENDENT RECORD [
scanTable: RECORD [
scanTab:    TableRef RELATIVE POINTER TO ScanTable,
hashTab:    TableRef RELATIVE POINTER TO HashTable,
vocabIndex: TableRef RELATIVE POINTER TO IndexTable,
vocabBody:  TableRef RELATIVE POINTER TO Vocabulary],
parseTable: RECORD [
prodData:   TableRef RELATIVE POINTER TO ProdData,
nStart:     TableRef RELATIVE POINTER TO NStarts,
nLength:    TableRef RELATIVE POINTER TO NLengths,
nSymbol:    TableRef RELATIVE POINTER TO NSymbols,
nAction:    TableRef RELATIVE POINTER TO NActions,
ntDefaults: TableRef RELATIVE POINTER TO NTDefaults,
tStart:     TableRef RELATIVE POINTER TO TStarts,
tLength:    TableRef RELATIVE POINTER TO TLengths,
tSymbol:    TableRef RELATIVE POINTER TO TSymbols,
tAction:    TableRef RELATIVE POINTER TO TActions]];

  TableRef: TYPE = LONG BASE POINTER TO Table;
  ScanTableRef: TYPE = LONG POINTER TO ScanTable;
  HashTableRef: TYPE = LONG POINTER TO HashTable;
  IndexTableRef: TYPE = LONG POINTER TO IndexTable;
  VocabularyRef: TYPE = LONG POINTER TO Vocabulary;
  ProdDataRef: TYPE = LONG POINTER TO ProdData;
  NStartsRef: TYPE = LONG POINTER TO NStarts;
  NLengthsRef: TYPE = LONG POINTER TO NLengths;
  NSymbolsRef: TYPE = LONG POINTER TO NSymbols;
  NActionsRef: TYPE = LONG POINTER TO NActions;
  NTDefaultsRef: TYPE = LONG POINTER TO NTDefaults;
  TStartsRef: TYPE = LONG POINTER TO TStarts;
  TLengthsRef: TYPE = LONG POINTER TO TLengths;
  TSymbolsRef: TYPE = LONG POINTER TO TSymbols;
  TActionsRef: TYPE = LONG POINTER TO TActions;

  }.