-- file PGSParseTable.mesa
-- created by PGS from PGSScan.Mesa, 29-Aug-80  9:27

ParseTable: DEFINITIONS = 
  BEGIN

  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 = FIRST[TSymbol];
  EndMarker: TSymbol = LAST[TSymbol];

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

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

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

  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.