-- file ParseTable.Mesa
-- created by PGS from Pass1T.Mesa,  8-Jan-80  9:40

ParseTable: DEFINITIONS = 
  BEGIN

  Symbol: TYPE = [0..255];
  TSymbol: TYPE = Symbol [0..139];
  NTSymbol: TYPE = Symbol [0..125];

-- token indices for the scanner and parser
  tokenID: TSymbol =  1;
  tokenNUM: TSymbol =  2;
  tokenLNUM: TSymbol =  3;
  tokenSTR: TSymbol =  4;
  tokenLSTR: TSymbol =  5;
  tokenCHAR: TSymbol =  6;
  tokenMINUS: TSymbol = 21;
  tokenDOT: TSymbol = 25;
  tokenDOTS: TSymbol = 10;
  tokenEQUAL: TSymbol = 13;
  tokenARROW: TSymbol = 11;
  tokenLESS: TSymbol = 15;
  tokenLE: TSymbol = 17;
  tokenGREATER: TSymbol = 16;
  tokenGE: TSymbol = 18;
  InitialSymbol: TSymbol = 25;

  DefaultMarker: TSymbol = FIRST[TSymbol];
  EndMarker: TSymbol = LAST[TSymbol];

  HashIndex: TYPE = [0..209];
  VIndex: TYPE = [0..631];

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

  State: TYPE = [0..361];
  NTState: TYPE = State [0..175];
  TIndex: TYPE = [0..1517];
  NTIndex: TYPE = [0..266];
  Production: TYPE = [0..358];

  InitialState: State = 1;
  FinalState: State = 0;

  ActionTag: TYPE = MACHINE DEPENDENT RECORD [
    reduce: BOOLEAN,		-- TRUE iff reduce entry
    pLength: [0..17B]];		-- number of symbols in production rhs
  ActionEntry: TYPE = MACHINE DEPENDENT RECORD [
    tag: ActionTag,		-- [FALSE,0] if a shift entry
    transition: [0..3777B]];	-- production number / next state

  ProductionInfo: TYPE = MACHINE DEPENDENT RECORD [
    rule: [0..377B],		-- reduction rule
    lhs: Symbol];		-- production lhs symbol (NTSymbol)

  Table: TYPE = MACHINE DEPENDENT RECORD [
    scanTable: RECORD[
      hashTab: ARRAY HashIndex OF VocabHashEntry,
      scanTab: ARRAY CHARACTER [40C..177C] OF TSymbol,
      vocabBody: RECORD [  -- a string body
        length, maxlength: CARDINAL,
        text: PACKED ARRAY VIndex OF CHARACTER],
      vocabIndex: ARRAY TSymbol OF CARDINAL],
    parseTable: RECORD[
      prodData: ARRAY Production OF ProductionInfo,
      nStart: ARRAY NTState OF NTIndex,
      nLength: ARRAY NTState OF CARDINAL,
      nSymbol: ARRAY NTIndex OF NTSymbol,
      nAction: ARRAY NTIndex OF ActionEntry,
      ntDefaults: ARRAY NTSymbol OF ActionEntry,
      tStart: ARRAY State OF TIndex,
      tLength: ARRAY State OF CARDINAL,
      tSymbol: ARRAY TIndex OF TSymbol,
      tAction: ARRAY TIndex OF ActionEntry]];

  Handle: TYPE = POINTER TO Table;

  END.