-- MPParseTable.mesa
-- an NPGS production from MPPass1T.mesa, March 22, 1993 4:48:50 pm PST

MPParseTable: CEDAR DEFINITIONS = {

  Symbol: TYPE = CARDINAL[0..255];
  TSymbol: TYPE = Symbol[0..170];
  NTSymbol: TYPE = Symbol[0..150];

-- 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 = 24;
  tokenDOT: TSymbol = 29;
  tokenDOTS: TSymbol = 12;
  tokenPOWER: TSymbol = 26;
  tokenEQUAL: TSymbol = 15;
  tokenARROW: TSymbol = 13;
  tokenLESS: TSymbol = 17;
  tokenLE: TSymbol = 19;
  tokenGREATER: TSymbol = 18;
  tokenGE: TSymbol = 20;
  tokenNE: TSymbol = 16;
  tokenTILDE: TSymbol = 21;
  tokenBIND: TSymbol = 22;
  initialSymbol: TSymbol = 29;

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

  HashIndex: TYPE = CARDINAL[0..251];
  VIndex: TYPE = CARDINAL[0..772];


  VocabHashEntry: TYPE = RECORD [
    symbol: TSymbol,    -- symbol index
    link: HashIndex];    -- link to next entry

  State: TYPE = CARDINAL[0..493];
  NTState: TYPE = State[0..258];
  TIndex: TYPE = CARDINAL[0..2260];
  NTIndex: TYPE = CARDINAL[0..365];
  Production: TYPE = CARDINAL[0..475];
  Rule: TYPE = CARDINAL[0..241];

  ActionTag: TYPE = RECORD [
    reduce: BOOL,        -- TRUE iff reduce entry
    pLength: [0..15]];     -- number of symbols in production rhs

  ActionEntry: TYPE = RECORD [
    tag: ActionTag,          -- [FALSE,0] if a shift entry
    transition: [0..2047]];   -- production number / next state

  ProductionInfo: TYPE = RECORD [
    rule: Rule,        -- reduction rule
    lhs: 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 = TEXT;
  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;

  ScanTableRef: TYPE = REF ScanTable;
  InitScanTable: PROC RETURNS [ScanTableRef];

  HashTableRef: TYPE = REF HashTable;
  InitHashTable: PROC RETURNS [HashTableRef];

  IndexTableRef: TYPE = REF IndexTable;
  InitIndexTable: PROC RETURNS [IndexTableRef];

  VocabularyRef: TYPE = REF Vocabulary;
  InitVocabulary: PROC RETURNS [VocabularyRef];

  ProdDataRef: TYPE = REF ProdData;
  InitProdData: PROC RETURNS [ProdDataRef];

  NStartsRef: TYPE = REF NStarts;
  InitNStarts: PROC RETURNS [NStartsRef];

  NLengthsRef: TYPE = REF NLengths;
  InitNLengths: PROC RETURNS [NLengthsRef];

  NSymbolsRef: TYPE = REF NSymbols;
  InitNSymbols: PROC RETURNS [NSymbolsRef];

  NActionsRef: TYPE = REF NActions;
  InitNActions: PROC RETURNS [NActionsRef];

  NTDefaultsRef: TYPE = REF NTDefaults;
  InitNTDefaults: PROC RETURNS [NTDefaultsRef];

  TStartsRef: TYPE = REF TStarts;
  InitTStarts: PROC RETURNS [TStartsRef];

  TLengthsRef: TYPE = REF TLengths;
  InitTLengths: PROC RETURNS [TLengthsRef];

  TSymbolsRef: TYPE = REF TSymbols;
  InitTSymbols: PROC RETURNS [TSymbolsRef];

  TActionsRef: TYPE = REF TActions;
  InitTActions: PROC RETURNS [TActionsRef];


}.