-- file ParseInterface.mesa
-- created by PGS from xx.mesa, 17-Jan-83 12:49

ParseInterface: DEFINITIONS = {

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

-- token indices for the scanner and parser
  tSTRING: TSymbol =  4;
  tNAME: TSymbol =  3;
  tICON: TSymbol =  2;
  tSEMICOLON: TSymbol = 71;
  tDIV: TSymbol = 36;
  tDIVASG: TSymbol = 41;

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

  HashIndex: TYPE = [0..117];
  VIndex: TYPE = [0..231];

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

  State: TYPE = [0..219];
  NTState: TYPE = State [0..101];
  TIndex: TYPE = [0..754];
  NTIndex: TYPE = [0..162];
  Production: TYPE = [0..190];

  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)

  ScanTable: TYPE = ARRAY CHARACTER [40C..177C] OF TSymbol;
  HashTable: TYPE = ARRAY HashIndex OF VocabHashEntry;
  IndexTable: TYPE = ARRAY TSymbol OF CARDINAL;
  Vocabulary: TYPE = RECORD [
    length, maxlength: CARDINAL,
    text: PACKED ARRAY VIndex OF CHARACTER];
  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;

  Table: TYPE = MACHINE DEPENDENT RECORD [
    scanTable: RECORD[
      scanTab: ScanTable,
      hashTab: HashTable,
      vocabIndex: IndexTable,
      vocabBody: Vocabulary],
    parseTable: RECORD[
      prodData: ProdData,
      nStart: NStarts,
      nLength: NLengths,
      nSymbol: NSymbols,
      nAction: NActions,
      ntDefaults: NTDefaults,
      tStart: TStarts,
      tLength: TLengths,
      tSymbol: TSymbols,
      tAction: TActions]];

  TableRef: TYPE = LONG POINTER TO Table;
  ScanTableRef: TYPE = LONG POINTER TO ScanTable;
  HashTableRef: TYPE = LONG POINTER TO HashTable;
  IndexTableRef: TYPE = LONG POINTER TO IndexTable;
  VocabularyRef: TYPE = LONG POINTER TO Vocabulary;
  ProdDataRef: TYPE = LONG POINTER TO ProdData;
  NStartsRef: TYPE = LONG POINTER TO NStarts;
  NLengthsRef: TYPE = LONG POINTER TO NLengths;
  NSymbolsRef: TYPE = LONG POINTER TO NSymbols;
  NActionsRef: TYPE = LONG POINTER TO NActions;
  NTDefaultsRef: TYPE = LONG POINTER TO NTDefaults;
  TStartsRef: TYPE = LONG POINTER TO TStarts;
  TLengthsRef: TYPE = LONG POINTER TO TLengths;
  TSymbolsRef: TYPE = LONG POINTER TO TSymbols;
  TActionsRef: TYPE = LONG POINTER TO TActions;

  }.