-- file PPParseTable.mesa.
-- created by PGS from Pass1T.Mesa,  3-Feb-81  9:38
-- last edit by Russ Atkinson, 10-Feb-81 14:32:11
   -- LONG POINTER stuff

PPParseTable: DEFINITIONS = 
  BEGIN

  Symbol: TYPE = [0..255];
  TSymbol: TYPE = Symbol [0..148];
  NTSymbol: TYPE = Symbol [0..143];

-- 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;
  InitialSymbol: TSymbol = 27;

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

  HashIndex: TYPE = [0..223];
  VIndex: TYPE = [0..667];

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

  State: TYPE = [0..409];
  NTState: TYPE = State [0..200];
  TIndex: TYPE = [0..1560];
  NTIndex: TYPE = [0..283];
  Production: TYPE = [0..412];

  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 = LONG POINTER TO Table;
  ProdDataHandle: TYPE = LONG POINTER TO ARRAY Production OF ProductionInfo;

  END.