-- file ParseTable.mesa
-- created by PGS from Pass1T.mesa, June 25, 1986 11:59:00 am PDT

ParseTable: DEFINITIONS = {

  Symbol: TYPE = [0..255];
  TSymbol: TYPE = Symbol[0..159];
  NTSymbol: TYPE = Symbol[0..151];

-- token indices for the scanner and parser
  tokenID: TSymbol =  1;
  tokenNUM: TSymbol =  2;
  tokenLNUM: TSymbol =  3;
  tokenFLNUM: TSymbol =  4;
  tokenSTR: TSymbol =  5;
  tokenLSTR: TSymbol =  6;
  tokenCHAR: TSymbol =  7;
  tokenATOM: TSymbol =  8;
  tokenMINUS: TSymbol = 23;
  tokenDOT: TSymbol = 27;
  tokenDOTS: TSymbol = 12;
  tokenEQUAL: TSymbol = 15;
  tokenARROW: TSymbol = 13;
  tokenLESS: TSymbol = 17;
  tokenLE: TSymbol = 19;
  tokenGREATER: TSymbol = 18;
  tokenGE: TSymbol = 20;
  tokenNE: TSymbol = 16;
  tokenTILDE: TSymbol = 21;
  initialSymbol: TSymbol = 27;

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

  HashIndex: TYPE = [0..239];
  VIndex: TYPE = [0..723];

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

  State: TYPE = [0..461];
  NTState: TYPE = State[0..236];
  TIndex: TYPE = [0..1872];
  NTIndex: TYPE = [0..335];
  Production: TYPE = [0..454];

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;

  }.
