-- Pass1T.pgs
-- Copyright (C) 1985, 1986 by Xerox Corporation.  All rights reserved.
-- DO NOT CONVERT TO TIOGA FORMAT!  (PSG requires the mesa-style comments)
-- last modified by Satterthwaite, April 9, 1986 10:10:14 am PST
-- last modified by Donahue,  9-Dec-81 10:48:31
-- last modified by Maxwell, August 11, 1983 12:57 pm
-- Russ Atkinson (RRA) December 11, 1986 1:35:59 pm PST

-- pgs [grammar: Cedar] ← Pass1T.pgs

-- needs CBinary.bcd
-- output:
--      new version of Pass1T.mesa
--      tables in MesaTab.bcd, which is exported as a PROGRAM module to CBinary
--      table format description on ParseTable.mesa
--      log on PGS.log, grammar on Cedar.grammar
--      errors on Pass1T.errlog


DIRECTORY
  ComData: TYPE USING [idANY, idINT, idLOCK, cedar],
  ParseTable: TYPE USING [ActionEntry, ProdDataRef, TSymbol],
  P1: TYPE USING [
    ActionStack, Index, LinkStack, Value, ValueStack, nullValue,
    InputLoc, IdOfFirst, IdOfLock, IdOfRest],
  Symbols: TYPE USING [Name, nullName],
  SourceMap: TYPE USING [Cons],
  Tree: TYPE USING [AttrId, Link, Map, NodeName, Null],
  TreeOps: TYPE USING [
    FreeTree, ListLength, MakeNode, ExtractTree, InsertTree, OpName,
    PopTree, PushTree, PushHash, PushList, PushLit, PushProperList, PushSe,
    PushNode, SetAttr, SetInfo, UpdateList];

Pass1T: PROGRAM
    IMPORTS P1, SourceMap, TreeOps, dataPtr: ComData
    EXPORTS P1 = {
  -- parse tree building
  OPEN TreeOps;

  Op: TYPE = Tree.NodeName;

 -- local data base (supplied by parser)

  v: P1.ValueStack;
  l: P1.LinkStack;
  q: P1.ActionStack;
  prodData: ParseTable.ProdDataRef;

 -- initialization/termination

  AssignDescriptors: PUBLIC PROC[
      qd: P1.ActionStack, vd: P1.ValueStack, ld: P1.LinkStack,
      pp: ParseTable.ProdDataRef] = {
    q ← qd; v ← vd; l ← ld; prodData ← pp};


 -- error recovery (only)

  TokenValue: PUBLIC PROC[s: ParseTable.TSymbol] RETURNS[P1.Value] = {
    RETURN[P1.nullValue]};

 -- stack manipulation
 -- note that r and s may be overlaid in some parameterizations

  PushHashV: PROC[k: NAT] = {PushHash[v[k].r]};
  PushLitV: PROC[k: NAT] = {PushLit[v[k].r]};

  PushNodeV: PROC[k: NAT, count: INTEGER] = {PushNode[v[k].s, count]};
  PushListV: PROC[k: NAT] = {PushList[v[k].s]};
  PushProperListV: PROC[k: NAT] = {PushProperList[v[k].s]};

  SetAttrV: PROC[attr: Tree.AttrId, k: NAT] = {SetAttr[attr, v[k].s]};
  SetAttrs: PROC[attr1, attr2, attr3: BOOL ← FALSE] = {
    SetAttr[1,attr1];  SetAttr[2,attr2];  SetAttr[3,attr3]};
  
 -- value manipulation

  BoolV: PROC[k: NAT] RETURNS[BOOL] = {RETURN[v[k].s]};
  SetBoolV: PROC[k: NAT, b: BOOL] = {v[k].s ← b}; 

  OpV: PROC[k: NAT] RETURNS[Op] = {RETURN[v[k].s]};
  SetOpV: PROC[k: NAT, op: Op] = {v[k].s ← op};

  NegatedV: PROC[k: NAT] RETURNS[Op] = INLINE {
    negation: ARRAY Op[$relE .. $notin] OF Op = [
      relE: $relN,	relN: $relE,
      relL: $relGE,	relGE: $relL,
      relG: $relLE,	relLE: $relG,
      in: $notin,		notin: $in];
    RETURN[negation[v[k].s]]};


 -- shared processing routines

  DetachItem: Tree.Map = {PushTree[t]; RETURN [Tree.Null]};

  AnonField: PROC[type, default: Tree.Link, top: CARDINAL] = {
    PushField[Symbols.nullName, type, default, top]};

  PushField: PROC[id: Symbols.Name, type, default: Tree.Link, top: CARDINAL] = {
    PushHash[id];  PushTree[type];  PushTree[default];
    PushNode[$decl,3];  LinkToSource[top];
    SetAttrs[FALSE,public,FALSE]};


 -- the interpretation rules

  LinkToSource: PROC[index: CARDINAL] = {SetInfo[SourceMap.Cons[l[index]]]};

 -- propagated attributes
  public: BOOL;
  machineDep: BOOL;
  trusted, checked: BOOL;
  safety: BOOL;
          
  ProcessQueue: PUBLIC PROC[qI, top: CARDINAL] = {
    t1, t2: Tree.Link;
    FOR i: CARDINAL IN [0..qI) DO
      len: CARDINAL ← q[i].tag.pLength;
      top ← top-len+1;
      SELECT prodData[q[i].transition].rule FROM

       -- basic tree building
        0  => -- TABLE: MesaTab  TYPE: ParseTable  EXPORTS: CBinary
              -- GOAL:  goal

              --TERMINALS:
              --  id  num  lnum  flnum  string  lstring  char  atom
              --  ,  ;  :  ..  =>  ←
              --  =  #  <  >  <=  >=  ~
              --  +  -  *  /  ↑  .  @  !  '|
              --  RECORD  POINTER  REF  VAR
              --  LIST  ARRAY  SEQUENCE  DESCRIPTOR
              --  PROCEDURE  PROC  PORT  SIGNAL  ERROR  PROCESS
              --  PROGRAM  MONITOR  DEFINITIONS  ZONE  RELATIVE  LONG
              --  TYPE  FRAME  TO  ORDERED  UNCOUNTED  PAINTED
              --  BASE  OF  PACKED  RETURNS  SAFE  UNSAFE
              --  MONITORED  OVERLAID  COMPUTED  MACHINE  DEPENDENT
              --  DIRECTORY  IMPORTS  EXPORTS  SHARES  LOCKS  USING
              --  PUBLIC  PRIVATE  CEDAR  CHECKED  TRUSTED  UNCHECKED
              --  ENTRY  INTERNAL  INLINE  READONLY  CODE
              --  ABS  ALL  AND  APPLY  CONS  MAX  MIN  MOD
              --  NOT  OR  ORD  PRED  LENGTH  NEW  START  SUCC  VAL
              --  FORK  JOIN  LOOPHOLE  NARROW  ISTYPE   SIZE  BITS
              --  FIRST  LAST  NIL  TRASH  NULL  IF  THEN  ELSE
              --  WITH  FROM  FOR  DECREASING  IN
              --  THROUGH  UNTIL  WHILE  REPEAT  FINISHED
              --  RETURN  EXIT  LOOP  GOTO  GO
              --  FREE  WAIT  RESTART  NOTIFY  BROADCAST  STOP
              --  RESUME  REJECT  CONTINUE  RETRY  TRANSFER  STATE
              --  OPEN  ENABLE  ANY  EXITS
              --  )  ]  }  END  ENDLOOP  ENDCASE
              --  (  [  {  BEGIN  DO  SELECT

              --ALIASES:
              --  id       tokenID
              --  num      tokenNUM
              --  lnum     tokenLNUM
              --  flnum    tokenFLNUM
              --  string   tokenSTR
              --  lstring  tokenLSTR
              --  char     tokenCHAR
              --  atom     tokenATOM
              --  -        tokenMINUS
              --  .        tokenDOT
              --  ..       tokenDOTS
              --  =        tokenEQUAL
              --  =>       tokenARROW
              --  <        tokenLESS
              --  <=       tokenLE
              --  >        tokenGREATER
              --  >=       tokenGE
              --  #        tokenNE
              --  ~        tokenTILDE
              --  .        initialSymbol

              --PRODUCTIONS:

              -- goal           ::= . module . 
              -- goal           ::= . module .. 
          NULL;
        1  => -- module         ::= directory identlist cedar proghead trusted checked block
          BEGIN
          IF ~BoolV[top+6] THEN InsertTree[Tree.Null,2];
          PushTree[Tree.Null];
          t1 ← MakeNode[$body,4];
          t2 ← ExtractTree[2];
          PushTree[ExtractTree[5]];  PushTree[t2];
          PushTree[t1]; SetAttr[1,checked]; SetAttr[2,trusted];
          trusted ← BoolV[top+4];  checked ← BoolV[top+5];
          PushNode[$decl,3];  LinkToSource[top+1];
          SetAttrs[TRUE,TRUE,FALSE];
          PushNode[$module,6];  LinkToSource[top];  SetAttrV[1,top+3];
          END;
       2  => -- module         ::= directory identlist cedar defhead defbody 
          BEGIN
          IF ~BoolV[top+4] THEN InsertTree[Tree.Null,2];
          PushTree[Tree.Null];
          t1 ← MakeNode[$body,4];  t2 ← ExtractTree[2];
          PushTree[ExtractTree[5]];  PushTree[t2];  PushTree[t1];
          PushNode[$decl,3];  LinkToSource[top+1];
          SetAttrs[TRUE,TRUE,FALSE];
          PushNode[$module,6];  LinkToSource[top];  SetAttrV[1,top+3];
          END;
        3  => -- includeitem    ::= id : FROM string using
          BEGIN
          PushLitV[top+3];  PushHashV[top];
          PushNode[$diritem,-3];  LinkToSource[top];
          END;
        4  => -- includeitem    ::= id : TYPE using
              -- includeitem    ::= id using
              -- includeitem    ::= id : TYPE id using
          BEGIN
          IF len = 5 THEN PushHashV[top+3] ELSE PushTree[Tree.Null];
          PushHashV[top];
          PushNode[$diritem,-3];  LinkToSource[top];
          END;
        5  => -- cedar          ::= CEDAR
              -- cedar          ::=
          dataPtr.cedar ← safety ← trusted ← checked ← (len = 1);
        6  => -- proghead       ::= resident safe class arguments locks interface bindop public 
          BEGIN
          t1 ← ExtractTree[4];
          PushTree[ExtractTree[5]];  PushTree[ExtractTree[5]];
          PushNode[$programTC,2]; SetAttrV[1,top+2]; SetAttrV[3,top+1];
          IF ~BoolV[top+2] OR t1 # Tree.Null THEN PushTree[t1]
          ELSE {
            PushHash[P1.IdOfLock[]];  PushTree[Tree.Null];
            PushNode[$lambda,-2];  SetAttr[1,TRUE];  SetAttr[2,public]};
          machineDep ← FALSE;
          END;
        7  => -- resident       ::= 
          {public ← FALSE; SetBoolV[top,FALSE]; l[top] ← P1.InputLoc[]};
        8  => -- defhead        ::= definitions locks imports shares bindop public 
          BEGIN
          t1 ← ExtractTree[3];
          t2 ← PopTree[];  PushTree[Tree.Null];  PushTree[t2];
          PushNode[$definitionTC,0];  PushTree[t1];
          SetBoolV[top,FALSE];  machineDep ← FALSE;
          END;
        9  => -- definitions    ::= DEFINITIONS 
          public ← TRUE;
       10  => -- defbody        ::= BEGIN open declist END 
              -- defbody        ::= BEGIN open declist ; END 
              -- defbody        ::= { open declist } 
              -- defbody        ::= { open declist ; } 
          {PushListV[top+2]; PushTree[Tree.Null]; SetBoolV[top,TRUE]};
       11  => -- locks          ::= LOCKS primary lambda
          {PushNode[$lambda,-2]; SetAttr[1,FALSE]; SetAttr[2,FALSE]};
       12  => -- lambda         ::= USING ident typeexp
          BEGIN
          PushTree[Tree.Null];  PushNode[$decl,3];  LinkToSource[top+1];
          SetAttrs[FALSE,FALSE,FALSE];
          END;
       13  => -- moduleitem     ::= id 
               -- moduleitem     ::= id : id 
          BEGIN
          PushHashV[top];  PushHashV[top+(len-1)];
          PushNode[$item,2];  SetAttr[1, len = 3];  LinkToSource[top];
          END;
       14  => -- declaration    ::= identlist public entry readonly typeexp initialization 
          BEGIN
          IF BoolV[top+3] THEN {
            t1 ← PopTree[];
            PushNode[$varTC,1]; SetAttrs[FALSE,FALSE,TRUE];
            PushTree[t1]};
          IF OpV[top+2] # $none THEN PushNodeV[top+2,1];
          PushNode[$decl,3];  LinkToSource[top];
          SetAttrV[1,top+5]; SetAttr[2,public]; public ← BoolV[top+1];
          END;
       15  => -- declaration    ::= identlist public TYPE bindop public typeexp default 
          BEGIN
          public ← BoolV[top+4];
          PushNode[$typedecl,3];  LinkToSource[top];
          SetAttrs[TRUE,public,FALSE];  public ← BoolV[top+1];
          END;
       16  => -- declaration    ::= identlist public TYPE optsize 
          BEGIN
          PushNode[$opaqueTC,1];  PushTree[Tree.Null];
          PushNode[$typedecl,3];  LinkToSource[top];
          SetAttrs[TRUE,public,FALSE];  public ← BoolV[top+1];
          END;
       17  => -- public         ::= PUBLIC
          {SetBoolV[top,public]; public ← TRUE};
       18  => -- public         ::= PRIVATE
              -- procaccess     ::=
          {SetBoolV[top, public]; public ← FALSE};
       19  => -- public         ::=
          SetBoolV[top,public];
       20  => -- entry          ::= ENTRY
          SetOpV[top,$entry];
       21  => -- entry          ::= INTERNAL
          SetOpV[top,$internal];
       22  => -- entry          ::=
          {SetOpV[top,$none]; l[top] ← P1.InputLoc[]};
       23  => -- idlist'        ::= id 
              -- identlist'     ::= id : 
          {PushHashV[top]; v[top].s ← -1};
       24  => -- identlist'     ::= id position : 
          {PushHashV[top]; PushNode[$item,-2]; v[top].s ← -1};
       25  => -- idlist'        ::= id , idlist' 
              -- identlist'     ::= id , identlist' 
          {PushHashV[top]; v[top].s ← v[top+2].s-1};
       26  => -- identlist'     ::= id position , identlist' 
          BEGIN
          PushTree[ExtractTree[-(v[top+3].s-1)]];
          PushHashV[top];  PushNode[$item,-2];  v[top].s ← v[top+3].s-1;
          END;
       27  => -- position       ::= ( exp optbits ) 
          PushNode[$item,2];
       28  => -- optbits        ::= : bounds 
              -- interval       ::= [ bounds ] 
          PushNode[$intCC,2];
       29  => -- interval       ::= [ bounds ) 
          PushNode[$intCO,2];
       30  => -- interval       ::= ( bounds ] 
          PushNode[$intOC,2];
       31  => -- interval       ::= ( bounds ) 
          PushNode[$intOO,2];
       32  => -- typeexp        ::= id 
              -- range          ::= id
          PushHashV[top];
       33  => -- typeid'        ::= id . id 
          {PushHashV[top]; PushHashV[top+2]; PushNode[$dot,2]};
       34  => -- typeid'        ::= typeid' . id 
              -- typeappl       ::= typeappl . id 
          {PushHashV[top+2]; PushNode[$dot,2]};
       35  => -- typeid         ::= id id 
          {PushHashV[top+1]; PushHashV[top]; PushNode[$dot,2]};
       36  => -- typeid         ::= id typeid 
          {PushHashV[top]; PushNode[$dot,2]};
       37  => -- typeappl       ::= id length 
          {PushHashV[top]; PushNode[$apply,-2]};
       38  => -- typeappl       ::= typeid length 
              -- typeappl       ::= typeappl length 
          PushNode[$apply,2];
       39  => -- typecons       ::= interval 
          {PushSe[dataPtr.idINT]; PushNode[$subrangeTC,-2]};
       40  => -- typecons       ::= id interval 
              -- range          ::= id interval
          {PushHashV[top]; PushNode[$subrangeTC,-2]};
       41  => -- typecons       ::= typeid interval 
              -- range          ::= typeid interval
          PushNode[$subrangeTC,2];
       42  => -- typecons       ::= dependent { elementlist }
          BEGIN
          PushListV[top+2];
          PushNode[$enumeratedTC,1];  SetAttr[1,public]; SetAttr[2,machineDep];
          machineDep ← BoolV[top];
          END;
       43  => -- ident             ::= id position :
              -- element        ::= id ( exp ) 
          {PushHashV[top]; PushNode[$item,-2]};
       44  => -- element        ::= ( exp )
          {PushHash[Symbols.nullName]; PushNode[$item,-2]};
       45  => -- typecons       ::= dependent monitored RECORD reclist
          BEGIN
          IF ~BoolV[top+1] THEN PushNode[$recordTC,1]
          ELSE {
            t1 ← PopTree[];  v[top+2].s ← ListLength[t1];
            t1 ← UpdateList[t1,DetachItem];  t1 ← FreeTree[t1];
            PushList[v[top+2].s+1];  PushNode[$monitoredTC,1]};
          SetAttr[1,machineDep]; SetAttrV[2,top+3];  machineDep ← BoolV[top];
          SetAttr[3,TRUE];
          END;
       46  => -- typecons       ::= ordered base pointertype
          BEGIN
          t2 ← MakeNode[$pointerTC,1];
          t1 ← PopTree[];
          PushTree[t2];
          SetAttrV[1,top];  SetAttrV[2,top+1];  SetAttrV[3,top+2];
          IF t1 # Tree.Null THEN {PushTree[t1]; PushNode[$subrangeTC,2]};
          END;
       47  => -- typecons       ::= VAR typeexp
          {PushNode[$varTC,1]; SetAttrs[FALSE,FALSE,FALSE]};
       48  => -- typecons       ::= REF readonly typeexp
          BEGIN
          PushNode[$refTC,1];
          SetAttr[1,FALSE];  SetAttr[2,FALSE];  SetAttrV[3,top+1];
          PushNode[$longTC,1];
          END;
       49  => -- typecons       ::= REF readonly ANY
			-- typecons       ::= REF
          BEGIN
          PushNode[$anyTC, 0];  PushNode[$refTC,1];
          SetAttr[1,FALSE];  SetAttr[2,FALSE];
          IF len = 3 THEN SetAttrV[3,top+1] ELSE SetAttr[3,FALSE];
          PushNode[$longTC,1];
          END;
       50  => -- typecons       ::= LIST OF readonly typeexp
          BEGIN
          PushField[P1.IdOfFirst[], PopTree[], Tree.Null, top];
          PushField[P1.IdOfRest[], MakeNode[$linkTC,0], Tree.Null, top];
          PushList[2];
          PushNode[$recordTC,1];  SetAttrs[FALSE,FALSE,FALSE];
          PushNode[$listTC,1];  SetAttr[1,FALSE]; SetAttr[2,FALSE]; SetAttrV[3,top+2];
          PushNode[$longTC,1];
          END;
       51  => -- typecons       ::= packed ARRAY indextype OF typeexp
          {PushNode[$arrayTC,2]; SetAttrV[3,top]};
       52  => -- typecons       ::= DESCRIPTOR FOR readonly typeexp
          {PushNode[$arraydescTC,1]; SetAttrV[3,top+2]};
       53  => -- typecons       ::= safe transfermode arguments
          {PushNodeV[top+1,2]; SetAttrV[3,top]};
       54  => -- safe           ::=
          {SetBoolV[top,safety]; l[top] ← P1.InputLoc[]};
       55  => -- arglist        ::= ANY
              -- returnlist     ::= RETURNS ANY
          PushNode[$anyTC, 0];
       56  => -- typecons       ::= id RELATIVE typeexp
          {PushHashV[top]; PushNode[$relativeTC,-2]};
       57  => -- typecons       ::= typeid RELATIVE typeexp
          PushNode[$relativeTC,2];
       58  => -- typecons       ::= heap ZONE
          {PushNode[$zoneTC,0]; SetAttrV[1,top]; SetAttr[2,FALSE]};
       59  => -- typecons       ::= LONG typeexp
          PushNode[$longTC,1];
       60  => -- typecons       ::= FRAME [ id ]
          {PushHashV[top+2]; PushNode[$frameTC,1]};
       61  => -- typecons       ::= id PAINTED typeexp
          {PushHashV[top]; PushNode[$paintTC,-2]};
       62  => -- typecons       ::= typeid PAINTED typeexp
          PushNode[$paintTC,2];
       63  => -- monitored      ::= MONITORED
          BEGIN
          PushSe[dataPtr.idLOCK];
          PushField[P1.IdOfLock[], PopTree[], Tree.Null, top];
          SetBoolV[top,TRUE];
          END;
       64  => -- dependent      ::=
          -- dependent      ::= MACHINE DEPENDENT
          {SetBoolV[top,machineDep]; IF len # 0 THEN machineDep ← TRUE};
       65  => -- reclist        ::= [ ]
              -- reclist        ::= NULL
              -- reclist        ::= [ pairlist ]
              -- reclist        ::= [ typelist ]
          {IF len < 3 THEN PushList[0] ELSE PushListV[top+1];
            SetBoolV[top,FALSE]};
       66  => -- reclist        ::= [ pairlist , variantpair ]
          {PushList[v[top+1].s+1]; SetBoolV[top,TRUE]};
       67  => -- reclist        ::= [ variantpart default ]
          {t1 ← PopTree[]; AnonField[PopTree[], t1, top]; SetBoolV[top,TRUE]};
       68  => -- variantpart    ::= SELECT vcasehead FROM variantlist ENDCASE
              -- variantpart    ::= SELECT vcasehead FROM variantlist , ENDCASE
          BEGIN
          PushListV[top+3];
          PushNode[$unionTC,2]; SetAttr[1,machineDep]; SetAttrV[2,top+1];
          END;
       69  => -- variantpart    ::= packed SEQUENCE vcasehead OF typeexp
          BEGIN
          PushNode[$sequenceTC,2];
          SetAttr[1,machineDep]; SetAttrV[2,top+2]; SetAttrV[3,top];
          END;
       70  => -- vcasehead      ::= ident public tagtype
              -- pairitem       ::= identlist public typeexp default
              -- variantpair    ::= identlist public variantpart default
          BEGIN
          IF len = 3 THEN PushTree[Tree.Null];
          PushNode[$decl,3];  LinkToSource[top];
          SetAttrs[FALSE,public,FALSE]; public ← BoolV[top+1];
          IF len = 3 THEN SetBoolV[top,FALSE];
          END;
       71  => -- vcasehead      ::= COMPUTED tagtype
          {AnonField[PopTree[], Tree.Null, top]; SetBoolV[top,FALSE]};
       72  => -- vcasehead      ::= OVERLAID tagtype
          {AnonField[PopTree[], Tree.Null, top]; SetBoolV[top,TRUE]};
       73  => -- tagtype        ::= *
          PushNode[$implicitTC,0];
       74  => -- variantitem    ::= idlist => reclist
          BEGIN
          PushNode[$variantTC,1];
          SetAttr[1,machineDep];  SetAttrV[2,top+2];  SetAttr[3,TRUE];
          PushTree[Tree.Null];  PushNode[$typedecl,3];  LinkToSource[top];
          SetAttrs[TRUE,public,FALSE];
          END;
       75  => -- typelist       ::= id ← defaultopt
              -- typelist       ::= typecons default
              -- typelist       ::= typeid default
          {t1 ← PopTree[];
          	IF len = 3 THEN PushHashV[top];
          	AnonField[PopTree[], t1, top];
          	v[top].s ← -1};
       76  => -- typelist       ::= id
          {PushHashV[top]; AnonField[PopTree[], Tree.Null, top]; v[top].s ← -1};
       77  => -- typelist       ::= typecons default , typelist
              -- typelist       ::= typeid default , typelist
          BEGIN
          t1 ← ExtractTree[-(v[top+3].s-1)]; AnonField[ExtractTree[-(v[top+3].s-1)], t1, top];
          v[top].s ← v[top+3].s-1;
          END;
       78  => -- typelist       ::= id , typelist
          {PushHashV[top]; AnonField[PopTree[], Tree.Null, top]; v[top].s ← v[top+2].s-1};
       79  => -- typelist       ::= id ← defaultopt , typelist
          BEGIN
          t1 ← ExtractTree[-(v[top+4].s-1)]; PushHashV[top]; AnonField[PopTree[], t1, top];
          v[top].s ← v[top+4].s-1;
          END;
       80  => -- pointertype    ::= pointerprefix
          {PushSe[dataPtr.idANY]; SetBoolV[top,FALSE]};
       81  => -- pointertype    ::= pointerprefix TO readonly typeexp
          SetBoolV[top, BoolV[top+2]];
       82  => -- transfermode   ::= PROCEDURE
              -- transfermode   ::= PROC
          SetOpV[top,$procTC];
       83  => -- transfermode   ::= PORT
          SetOpV[top,$portTC];
       84  => -- transfermode   ::= SIGNAL
          SetOpV[top,$signalTC];
       85  => -- transfermode   ::= ERROR
          SetOpV[top,$errorTC];
       86  => -- transfermode   ::= PROCESS
          SetOpV[top,$processTC];
       87  => -- transfermode   ::= PROGRAM
          SetOpV[top,$programTC];
       88  => -- initialization ::=
          {PushTree[Tree.Null]; SetBoolV[top,FALSE]};
       89  => -- initvalue      ::= procaccess trusted checked inline entry block
          BEGIN
          IF ~BoolV[top+5] THEN InsertTree[Tree.Null,2];
          PushTree[Tree.Null];
          PushNode[$body,4];  SetAttrV[3,top+3];
          SetAttr[1,checked]; SetAttr[2,trusted];
          trusted ← BoolV[top+1]; checked ← BoolV[top+2];  public ← BoolV[top];
          IF OpV[top+4] # $none THEN PushNodeV[top+4,1];
          END;
       90  => -- initvalue      ::= CODE
          PushNode[$signalinit,0];
       91  => -- initvalue      ::= procaccess trusted checked MACHINE CODE BEGIN codelist END
              -- initvalue      ::= procaccess trusted checked MACHINE CODE { codelist }
          BEGIN
          PushProperListV[top+6]; PushNode[$inline,1];
          SetAttr[1,checked]; SetAttr[2,trusted];
          trusted ← BoolV[top+1]; checked ← BoolV[top+2];  public ← BoolV[top];
          END;
       92  => -- trusted        ::=
          SetBoolV[top,trusted];
       93  => -- codelist       ::= orderlist
          {PushListV[top]; v[top].s ← 1};
       94  => -- codelist       ::= codelist ; orderlist
          {PushListV[top+2]; v[top].s ← v[top].s+1};

       95  => -- statement      ::= IF exp THEN statement 
          {PushTree[Tree.Null]; PushNode[$if,3]; LinkToSource[top]};
       96  => -- statement      ::= IF exp THEN balstmt ELSE statement 
              -- balstmt        ::= IF exp THEN balstmt ELSE balstmt 
          {PushNode[$if,3]; LinkToSource[top]};
       97  => -- statement      ::= casehead casestmtlist ENDCASE => statement
              -- balstmt        ::= casehead casestmtlist ENDCASE => balstmt
          BEGIN
          t1 ← PopTree[];  PushProperListV[top+1];  PushTree[t1];
          IF BoolV[top] THEN PushNode[$bind,4] ELSE PushNode[$case,3];
          LinkToSource[top];
          END;
       98  => -- basicstmt      ::= lhs
          BEGIN
          t1 ← PopTree[];  PushTree[t1];
          IF OpName[t1] # $apply THEN {
            PushTree[Tree.Null]; PushNode[$apply,2]; SetAttr[1, FALSE]};
          LinkToSource[top];
          END;
       99  => -- basicstmt      ::= lhs ← exp 
          {PushNode[$assign,2]; LinkToSource[top]};
      100  => -- basicstmt      ::= [ explist ] ← exp 
          {PushNode[$extract,2]; LinkToSource[top]};
      101  => -- basicstmt      ::= trusted checked block 
          BEGIN
          IF BoolV[top+2] THEN {
            PushNode[$block,2];
            SetAttr[1,checked]; SetAttr[2,trusted];  LinkToSource[top+2]}
          ELSE IF checked # BoolV[top+1] OR (~checked AND trusted) THEN {
            PushNode[$checked,1]; 
            SetAttr[1,checked]; SetAttr[2,trusted];  LinkToSource[top+2]};
          trusted ← BoolV[top]; checked ← BoolV[top+1];
          t1 ← ExtractTree[2];
          IF t1 # Tree.Null THEN {
            PushTree[t1]; PushNode[$open,-2]; LinkToSource[top+2]};
          END;
      102  => -- basicstmt      ::= casehead casestmtlist ENDCASE
          BEGIN
          PushProperListV[top+1];  PushTree[Tree.Null];
          IF BoolV[top] THEN PushNode[$bind,4] ELSE PushNode[$case,3];
          LinkToSource[top];
          END;
      103  => -- basicstmt      ::= forclause dotest DO scope doexit ENDLOOP 
          BEGIN
          IF BoolV[top+3] THEN {
            t1 ← PopTree[];  t2 ← PopTree[];
            PushNode[$block,2]; SetAttr[1,checked]; SetAttr[2,trusted]; LinkToSource[top+2];
            PushTree[t2];  PushTree[t1]};
          PushNode[$do,6];  LinkToSource[top];
          END;
      104  => -- basicstmt      ::= EXIT 
          {PushNode[$exit,0]; LinkToSource[top]};
      105  => -- basicstmt      ::= LOOP 
          {PushNode[$loop,0]; LinkToSource[top]};
      106  => -- basicstmt      ::= GOTO id 
          {PushHashV[top+1]; PushNode[$goto,1]; LinkToSource[top]};
      107  => -- basicstmt      ::= GO TO id 
          {PushHashV[top+2]; PushNode[$goto,1]; LinkToSource[top]};
      108  => -- basicstmt      ::= RETURN optargs
          {PushNode[$return,1]; SetAttrV[3,top+1]; LinkToSource[top]};
      109  => -- basicstmt      ::= transfer lhs
          {PushNodeV[top,1]; LinkToSource[top]};
      110  => -- basicstmt      ::= free [ exp optcatch ]
          BEGIN
          IF BoolV[top+3] THEN {
            t1 ← PopTree[]; PushTree[Tree.Null]; PushTree[t1]; PushNode[$free,4]}
          ELSE  {PushTree[Tree.Null]; PushNode[$free,3]};
          LinkToSource[top];
          END;
      111  => -- basicstmt      ::= WAIT lhs
          {PushNode[$wait,1]; LinkToSource[top]};
      112  => -- basicstmt      ::= ERROR
          {PushNode[$syserror,0]; LinkToSource[top]};
      113  => -- basicstmt      ::= STOP
          {PushNode[$stop,0]; LinkToSource[top]};
      114  => -- basicstmt      ::= NULL
          {PushNode[$null,0]; LinkToSource[top]};
      115  => -- basicstmt      ::= RESUME optargs
          {PushNode[$resume,1]; SetAttrV[3,top+1]; LinkToSource[top]};
      116  => -- basicstmt      ::= REJECT
          {PushNode[$reject,0]; LinkToSource[top]};
      117  => -- basicstmt      ::= CONTINUE
          {PushNode[$continue,0]; LinkToSource[top]};
      118  => -- basicstmt      ::= RETRY
          {PushNode[$retry,0]; LinkToSource[top]};
      119  => -- basicstmt      ::= lhs ← STATE
          {PushNode[$dst,1]; LinkToSource[top]};
      120  => -- basicstmt      ::= STATE ← exp
          {PushNode[$lst,1]; LinkToSource[top]};
      121  => -- block          ::= BEGIN scope exits END
              -- block          ::= { scope exits }
          IF BoolV[top+2] THEN {
            -- an exits clause is present; build a label node
            IF BoolV[top+1] THEN { 
              t1 ← PopTree[];
              PushNode[$block,2]; SetAttr[1,checked]; SetAttr[2,trusted]; LinkToSource[top+1];
              PushTree[t1]};
            SetBoolV[top,FALSE];  PushNode[$label,2];  LinkToSource[top]}
          ELSE -- things are unchanged; propogate the "block needs to be made" bit
            SetBoolV[top,BoolV[top+1]];
     122  => -- scope          ::= open enables statementlist
          BEGIN
          PushListV[top+2];
          SetBoolV[top,FALSE];
          IF BoolV[top+1] THEN {PushNode[$enable,2]; LinkToSource[top+1]};
          END;
     123  => -- scope          ::= open enables declist ; statementlist
          BEGIN
          PushListV[top+4];
          t1 ← PopTree[]; PushListV[top+2]; PushTree[t1];
          IF BoolV[top+1] THEN {
            PushNode[$block,2]; SetAttr[1,checked]; SetAttr[2,checked]; LinkToSource[top+2];
            PushNode[$enable,2];  LinkToSource[top+1];  SetBoolV[top,FALSE]}
          ELSE SetBoolV[top,TRUE];
          END;
      124  => -- binditem       ::= exp
          {PushHash[Symbols.nullName]; PushNode[$item,-2]; LinkToSource[top]};
      125  => -- binditem       ::= id ~ ~ exp
              -- binditem       ::= id : exp
          {PushHashV[top]; PushNode[$item,-2]; LinkToSource[top]};
      126  => -- exits          ::= EXITS exitlist
          {PushListV[top+1]; SetBoolV[top,TRUE]};
      127  => -- casestmtitem   ::= caselabel => statement
              -- caseexpitem    ::= caselabel => exp
              -- exititem       ::= idlist => statement
          {PushNode[$item,2]; LinkToSource[top]};
      128  => -- casetest       ::= optrelation 
          {PushTree[Tree.Null]; PushNodeV[top,-2]};
      129  => -- casetest       ::= exp 
          {PushTree[Tree.Null]; PushNode[$relE,-2]};
      130  => -- caselabel      ::= ident typeexp
              -- controlid      ::= ident typeexp 
          BEGIN
          PushTree[Tree.Null]; PushNode[$cast,1];  PushNode[$decl,3];  LinkToSource[top];
          SetAttrs[FALSE,public,FALSE];
          END;
      131  => -- forclause      ::= FOR controlid ← exp , exp 
          PushNode[$forseq,3];
      132  => -- forclause      ::= FOR controlid direction IN range 
          {PushTree[Tree.Null]; PushNodeV[top+2,3]};
      133  => -- forclause      ::= THROUGH range
          {InsertTree[Tree.Null,2]; PushTree[Tree.Null]; PushNode[$upthru,-3]};
      134  => -- direction      ::= DECREASING 
              -- direction      ::=  
          IF len = 0 THEN SetOpV[top,$upthru] ELSE SetOpV[top,$downthru];
      135  => -- dotest         ::= UNTIL exp 
          PushNode[$not,1];
      136  => -- doexit         ::=
              -- doexit         ::= REPEAT exitlist
          {IF len = 0 THEN PushTree[Tree.Null] ELSE PushListV[top+1];
           PushTree[Tree.Null]};
      137  => -- doexit         ::= REPEAT exitlist FINISHED => statement
              -- doexit         ::= REPEAT exitlist FINISHED => statement ;
          {t1 ← PopTree[]; PushListV[top+1]; PushTree[t1]};
      138  => -- enables        ::= ENABLE catchcase ;
          {PushTree[Tree.Null]; PushNode[$catch,2]; SetBoolV[top,TRUE]};
      139  => -- enables        ::= ENABLE catchany ;
          {PushTree[Tree.Null]; PushNode[$catch,-2]; SetBoolV[top,TRUE]};
      140  => -- enables        ::= ENABLE BEGIN catchlist END ;
              -- enables        ::= ENABLE { catchlist } ;
              -- optcatch       ::= ! catchlist
          BEGIN
          t1 ← PopTree[];
          IF len = 2 THEN PushListV[top+1] ELSE PushListV[top+2];
          PushTree[t1];
          PushNode[$catch,2];
          SetBoolV[top,TRUE];
          END;
      141  => -- catchlist      ::= catchhead catchcase
          {v[top].s ← v[top].s + 1; PushTree[Tree.Null]};
      142  => -- catchcase      ::= lhslist => statement
          BEGIN
          t1 ← PopTree[];  PushListV[top];  PushTree[t1];
          PushNode[$item,2];  LinkToSource[top];
          END;
      143  => -- optargs        ::= [ explist ]
          BEGIN
          t1 ← PopTree[];
          IF t1 = Tree.Null THEN PushProperList[0] ELSE PushTree[t1];
          SetBoolV[top,FALSE];
          END;
      144  => -- optargs        ::= 
          {PushTree[Tree.Null]; l[top] ← P1.InputLoc[]; SetBoolV[top,FALSE]};
      145  => -- transfer       ::= SIGNAL
          SetOpV[top,$signal];
      146  => -- transfer       ::= ERROR
          SetOpV[top,$error];
      147  => -- transfer       ::= RETURN WITH ERROR
          SetOpV[top,$xerror];
      148  => -- transfer       ::= START
          SetOpV[top,$start];
      149  => -- transfer       ::= RESTART
          SetOpV[top,$restart];
      150  => -- transfer       ::= JOIN
          SetOpV[top,$join];
      151  => -- transfer       ::= NOTIFY
          SetOpV[top,$notify];
      152  => -- transfer       ::= BROADCAST
          SetOpV[top,$broadcast];
      153  => -- transfer       ::= TRANSFER WITH
          SetOpV[top,$lste];
      154  => -- transfer       ::= RETURN WITH
          SetOpV[top,$lstf];

       -- expression processing
      155  => -- keyitem        ::= id ~ optexp
              -- keyitem        ::= id : optexp
          {PushHashV[top]; PushNode[$item,-2]}; 
      156  => -- defaultopt     ::= trash
              -- optexp         ::= trash
              -- initvalue      ::= trash
          PushNode[$void,0];
      157  => -- defaultopt     ::= exp '| trash
          {PushNode[$void,0]; PushList[2]};
      158  => -- exp            ::= IF exp THEN exp ELSE exp 
          PushNode[$ifx,3];
      159  => -- exp            ::= casehead caseexplist ENDCASE => exp 
          BEGIN
          t1 ← PopTree[];
          PushProperListV[top+1];  PushTree[t1];
          IF BoolV[top] THEN PushNode[$bindx,4] ELSE PushNode[$casex,3];
          LinkToSource[top];
          END;
      160  => -- exp            ::= lhs ← exp 
          PushNode[$assignx,2];
      161  => -- exp            ::= [ explist ] ← exp 
          PushNode[$extractx,2];
      162  => -- exp            ::= ERROR 
          PushNode[$syserrorx,0];
      163  => -- disjunct       ::= disjunct OR conjunct 
          PushNode[$or,2];
      164  => -- conjunct       ::= conjunct AND negation 
          PushNode[$and,2];
      165  => -- negation       ::= ~ relation 
              -- negation       ::= NOT relation 
        PushNode[$not,1];
      166  => -- relation       ::= sum optrelation 
              -- sum            ::= sum addop product 
              -- product        ::= product multop factor 
          PushNodeV[top+1,2];
      167  => -- optrelation    ::= NOT relationtail 
          SetOpV[top, NegatedV[top+1]];
      168  => -- relationtail   ::= IN range 
          SetOpV[top,$in];
      169  => -- relop          ::= = 
          SetOpV[top,$relE];
      170  => -- relop          ::= # 
          SetOpV[top,$relN];
      171  => -- relop          ::= < 
          SetOpV[top,$relL];
      172  => -- relop          ::= <= 
          SetOpV[top,$relLE];
      173  => -- relop          ::= > 
          SetOpV[top,$relG];
      174  => -- relop          ::= >= 
          SetOpV[top,$relGE];
      175  => -- addop          ::= + 
          SetOpV[top,$plus];
      176  => -- addop          ::= - 
          SetOpV[top,$minus];
      177  => -- multop         ::= * 
          SetOpV[top,$times];
      178  => -- multop         ::= / 
          SetOpV[top,$div];
      179  => -- multop         ::= MOD 
          SetOpV[top,$mod];
      180  => -- factor         ::= addop primary 
          IF OpV[top] = $minus THEN PushNode[$uminus,1];
      181  => -- primary         ::= [ explist ]
          {PushTree[Tree.Null]; PushNode[$apply,-2]; SetAttr[1, FALSE]};
      182  => -- primary        ::= prefixop [ orderlist ]
          {PushListV[top+2]; PushNodeV[top,1]};
      183  => -- primary        ::= VAL [ orderlist ]
          {PushListV[top+2]; PushNode[$val,1]};
      184  => -- primary        ::= ALL [ orderlist ]
          {PushListV[top+2]; PushNode[$all,1]};
      185  => -- primary        ::= new [ typeexp initialization optcatch ]
          {PushNode[$new, IF BoolV[top+4] THEN 4 ELSE 3]; SetAttrV[1,top+3]};
      186  => -- primary        ::= cons [ explist optcatch ]
          PushNode[$cons, IF BoolV[top+3] THEN 3 ELSE 2];
      187  => -- primary        ::= listcons [ explist ]
          PushNode[$listcons,2];
      188  => -- primary        ::= NIL 
          {PushTree[Tree.Null]; PushNode[$nil,1]};
      189  => -- primary        ::= typeop [ typeexp ]
              -- exp            ::= transferop lhs 
          PushNodeV[top,1];
      190  => -- qualifier      ::= . prefixop 
              -- qualifier      ::= . typeop
          PushNodeV[top+1,1];
      191  => -- primary        ::= SIZE [ typeexp ]
              -- qualifier      ::= . SIZE
              -- primary        ::= SIZE [ typeexp , exp ]
          {IF len < 5 THEN PushTree[Tree.Null];  PushNode[$size,2]; SetAttr[1, FALSE]};
      192  => -- primary        ::= BITS [ typeexp ]
              -- qualifier      ::= . BITS
              -- primary        ::= BITS [ typeexp , exp ]
          {IF len < 5 THEN PushTree[Tree.Null];  PushNode[$size,2]; SetAttr[1, TRUE]};
      193  => -- primary        ::= ISTYPE [ exp , typeexp ] 
          PushNode[$istype,2];
      194  => -- primary        ::= @ lhs
          PushNode[$addr,1];
      195  => -- primary        ::= DESCRIPTOR [ desclist ]
          PushNode[$arraydesc,1];
      196  => -- lhs            ::= id 
              -- element        ::= id
              -- ident          ::= id : 
              -- controlid      ::= id 
          PushHashV[top];
      197  => -- lhs            ::= num 
              -- lhs            ::= string 
          PushLitV[top];
      198  => -- lhs            ::= lnum 
          {PushLitV[top]; PushNode[$mwconst,1]; SetAttr[1,FALSE]};
      199  => -- lhs            ::= flnum 
          {PushLitV[top]; PushNode[$mwconst,1]; SetAttr[1,TRUE]};
      200  => -- lhs            ::= char 
          {PushLitV[top]; PushNode[$clit,1]};
      201  => -- lhs            ::= lstring 
          {PushLitV[top]; PushNode[$llit,1]};
      202  => -- lhs            ::= atom 
          {PushHashV[top]; PushNode[$atom,1]};
      203  => -- lhs            ::= NARROW [ exp opttype optcatch ]
          PushNode[$narrow, IF BoolV[top+4] THEN 3 ELSE 2];
      204  => -- lhs            ::= LOOPHOLE [ exp opttype ]
          PushNode[$loophole,2];
      205  => -- lhs            ::= APPLY [ exp , exp optcatch ]
           {PushNode[$apply, IF BoolV[top+5] THEN 3 ELSE 2]; SetAttr[1,TRUE]};
      206  => -- qualifier      ::= [ explist optcatch ]
          {PushNode[$apply, IF BoolV[top+2] THEN 3 ELSE 2]; SetAttr[1,FALSE]};
      207  => -- qualifier      ::= . id
          {PushHashV[top+1]; PushNode[$dot,2]};
      208  => -- qualifier      ::= ↑
          PushNode[$uparrow,1];
      209  => -- transferop     ::= SIGNAL
          SetOpV[top,$signalx];
      210  => -- transferop     ::= ERROR
          SetOpV[top,$errorx];
      211  => -- transferop     ::= START
          SetOpV[top,$startx];
      212  => -- transferop     ::= JOIN
          SetOpV[top,$joinx];
      213  => -- transferop     ::= NEW 
          SetOpV[top,$create];
      214  => -- transferop     ::= FORK
          SetOpV[top,fork];
      215  => -- prefixop       ::= LONG 
          SetOpV[top,$lengthen];
      216  => -- prefixop       ::= ABS 
          SetOpV[top,$abs];
      217  => -- prefixop       ::= PRED 
          SetOpV[top,$pred];
      218  => -- prefixop       ::= SUCC 
          SetOpV[top,$succ];
      219  => -- prefixop       ::= ORD 
          SetOpV[top,$ord];
      220  => -- prefixop       ::= MIN 
          SetOpV[top,$min];
      221  => -- prefixop       ::= MAX 
          SetOpV[top,$max];
      222  => -- prefixop       ::= BASE
          SetOpV[top,$base];
      223  => -- prefixop       ::= LENGTH
          SetOpV[top,$length];
      224  => -- typeop         ::= CODE
          SetOpV[top,$typecode];
      225  => -- typeop         ::= FIRST
          SetOpV[top,$first];
      226  => -- typeop         ::= LAST
          SetOpV[top,$last];
      227  => -- typeop         ::= NIL
          SetOpV[top,$nil];
      228  => -- desclist       ::= exp , exp opttype
          PushList[3];
      229  => -- directory      ::= DIRECTORY ;
              -- imports        ::= IMPORTS
              -- exports        ::= EXPORTS 
              -- fieldlist      ::= [ ]
              -- new            ::= NEW
              -- free           ::= FREE
              -- cons           ::= CONS
              -- listcons       ::= LIST
              -- pointerprefix  ::= POINTER
              -- catchlist      ::= catchhead
          PushTree[Tree.Null];
      230  => -- using          ::= USING [ ]
              -- defaultopt     ::=
          PushProperList[0];
      231  => -- elementlist    ::=
              -- statementlist  ::= 
              -- casestmtlist   ::=
              -- exitlist       ::= 
              -- catchhead      ::=
              -- caseexplist    ::=
              -- includelist    ::= includeitem
              -- modulelist     ::= moduleitem
              -- declist        ::=  declaration
              -- pairlist       ::= pairitem
              -- elementlist'   ::= element
              -- variantlist    ::= variantitem
              -- bindlist       ::= binditem
              -- statementlist' ::= statement 
              -- casestmtlist'  ::= casestmtitem
              -- caselabel'     ::= casetest 
              -- exitlist'      ::= exititem
              -- lhslist        ::= lhs
              -- orderlist      ::= optexp 
              -- keylist        ::= keyitem 
              -- caseexplist'   ::= caseexpitem
          v[top].s ← len;
      232  => -- includelist    ::= includelist , includeitem
              -- modulelist     ::= modulelist , moduleitem
              -- declist        ::= declist ; declaration 
              -- pairlist       ::= pairlist , pairitem
              -- elementlist'   ::= elementlist' , element
              -- variantlist    ::= variantlist , variantitem
              -- bindlist       ::= bindlist , binditem
              -- statementlist' ::= statementlist' ;  statement 
              -- casestmtlist'  ::= casestmtlist' ; casestmtitem
              -- caselabel'     ::= caselabel' , casetest 
              -- exitlist'      ::= exitlist' ; exititem
              -- catchhead      ::= catchhead  catchcase ;
              -- lhslist        ::= lhslist , lhs
              -- orderlist      ::= orderlist , optexp 
              -- keylist        ::= keylist , keyitem 
              -- caseexplist'   ::= caseexplist' , caseexpitem
          v[top].s ← v[top].s+1;
      233  => -- idlist         ::= idlist'
              -- identlist      ::= identlist'
              -- explist        ::= orderlist
              -- explist        ::= keylist
              -- caselabel      ::= caselabel' 
              -- directory      ::= DIRECTORY includelist ;
              -- imports        ::= IMPORTS modulelist
              -- exports        ::= EXPORTS modulelist 
              -- open           ::= OPEN bindlist ;
              -- fieldlist      ::= [ pairlist ]
              -- fieldlist      ::= [ typelist ]
          IF len > 1 THEN PushListV[top+1] ELSE PushListV[top];
      234  => -- class          ::= PROGRAM 
              -- safe           ::= UNSAFE
              -- initialization ::= ← initvalue
              -- casehead       ::= SELECT exp FROM
          SetBoolV[top,FALSE];
      235  => -- class          ::= MONITOR 
              -- packed                ::= PACKED
              -- safe           ::= SAFE
              -- readonly       ::= READONLY
              -- reclist        ::= [ variantpair ]
              -- ordered        ::= ORDERED
              -- base           ::= BASE
              -- heap           ::= UNCOUNTED
              -- initialization ::= bindop initvalue
              -- inline                ::= INLINE
              -- optargs        ::= lhs
              -- casehead       ::= WITH binditem SELECT optexp FROM
          SetBoolV[top,TRUE];
      236  => -- packed                ::=
              -- readonly       ::=
              -- monitored      ::=
              -- ordered        ::=
              -- base           ::=
              -- heap           ::=
              -- inline                ::=
              -- enables        ::=
              -- exits          ::=
              -- optcatch       ::=
          {SetBoolV[top,FALSE]; l[top] ← P1.InputLoc[]};
      237  => -- using          ::= USING [ idlist ]
              -- interface      ::= imports exports shares
              -- shares         ::= SHARES idlist 
              -- bindop         ::= ~ 
              -- bindop         ::= = 
              -- typeid         ::= typeid'
              -- typeexp        ::= typeid 
              -- typeexp        ::= typecons 
              -- typecons       ::= typeappl 
              -- optsize        ::= [ exp ] 
              -- elementlist    ::= elementlist' 
              -- length         ::= [ exp ] 
              -- default        ::= ← defaultopt 
              -- defaultopt     ::= exp 
              -- tagtype        ::= typeexp 
              -- pointerprefix  ::= POINTER interval 
              -- indextype      ::= typeexp 
              -- arguments      ::= arglist returnlist 
              -- arglist        ::= fieldlist 
              -- returnlist     ::= RETURNS fieldlist 
              -- initvalue      ::= exp 
              -- statement      ::= basicstmt 
              -- balstmt        ::= basicstmt 
              -- dotest         ::= WHILE exp 
              -- catchany       ::= ANY => statement
              -- catchlist      ::= catchhead catchany 
              -- catchlist      ::= catchhead catchany ; 
              -- statementlist  ::= statementlist' 
              -- statementlist  ::= statementlist' ; 
              -- casestmtlist   ::= casestmtlist' 
              -- casestmtlist   ::= casestmtlist' ; 
              -- exitlist        ::= exitlist'
              -- exitlist       ::= exitlist' ;
              -- caseexplist    ::= caseexplist' 
              -- caseexplist    ::= caseexplist' , 
              -- trash          ::= TRASH 
              -- trash          ::= NULL 
              -- optexp         ::= exp 
              -- exp            ::= disjunct 
              -- disjunct       ::=C conjunct 
              -- conjunct       ::=C negation 
              -- negation       ::=C relation 
              -- relation       ::= sum 
              -- optrelation    ::= relationtail 
              -- relationtail   ::= relop sum 
              -- range          ::= interval 
              -- range          ::= typeid 
              -- bounds         ::= exp .. exp 
              -- sum            ::=C product 
              -- product        ::=C factor 
              -- factor         ::=C primary 
              -- primary        ::= lhs 
              -- desclist       ::= exp 
              -- lhs            ::= ( exp ) 
              -- lhs            ::= lhs qualifier 
              -- new            ::= lhs . NEW
              -- free           ::= lhs . FREE
              -- cons           ::= lhs . CONS
              -- listcons       ::= lhs . LIST
              -- opttype        ::= , typeexp
          NULL;
      238  => -- directory      ::= 
              -- using          ::= 
              -- locks          ::= 
              -- lambda         ::= 
              -- imports        ::= 
              -- exports        ::= 
              -- shares         ::= 
              -- optsize        ::= 
              -- optbits        ::= 
              -- default        ::= 
              -- open           ::=
              -- arglist        ::= 
              -- returnlist     ::= 
              -- indextype      ::=
              -- forclause      ::= 
              -- dotest         ::= 
              -- optexp         ::=
              -- opttype        ::=
          {PushTree[Tree.Null]; l[top] ← P1.InputLoc[]};
     239  => -- checked         ::=
          {SetBoolV[top,checked];  trusted ← checked};
     240  => -- checked         ::= CHECKED
          {SetBoolV[top,checked]; trusted ← checked ← TRUE};
     241  => -- checked         ::= TRUSTED
          {SetBoolV[top,checked]; trusted ← TRUE; checked ← FALSE};
     242  => -- checked         ::= UNCHECKED
          {SetBoolV[top,checked]; trusted ← checked ← FALSE};

       -- error or unimplemented
        ENDCASE =>  ERROR;

      ENDLOOP};

  }.