-- file ParseTable.mesa
-- created by PGS from DIPack.Mesa, 25-Oct-80 21:06

ParseTable: DEFINITIONS = 
  BEGIN

  Symbol: TYPE = [0..255];
  TSymbol: TYPE = Symbol [0.. 62];
  NTSymbol: TYPE = Symbol [0.. 26];

-- token indices for the scanner and parser
  tokenID: TSymbol =  1;
  tokenNUM: TSymbol =  2;
  tokenLNUM: TSymbol =  3;
  tokenCARD: TSymbol =  4;
  tokenLCARD: TSymbol =  5;
  tokenSTR: TSymbol =  6;
  tokenCHAR: TSymbol =  7;
  tokenMINUS: TSymbol = 12;
  tokenDOT: TSymbol = 16;
  tokenDOTS: TSymbol = 54;
  tokenEQUAL: TSymbol = 20;
  tokenLESS: TSymbol = 22;
  tokenLE: TSymbol = 24;
  tokenGREATER: TSymbol = 23;
  tokenGE: TSymbol = 25;
  endmarker: TSymbol = 62;

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

  HashIndex: TYPE = [0.. 93];
  VIndex: TYPE = [0..214];

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

  State: TYPE = [0.. 82];
  NTState: TYPE = State [0.. 31];
  TIndex: TYPE = [0..270];
  NTIndex: TYPE = [0.. 34];
  Production: TYPE = [0..101];

  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.