-- file MPPass1T.mesa rewritten by NPGS, March 22, 1993 4:48:50 pm PST -- file MPPass1T.pgs -- Copyright (C) 1985, 1986, 1989, 1990, 1991 by Xerox Corporation. All rights reserved. -- DO NOT CONVERT TO TIOGA FORMAT! (NPGS 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) January 13, 1987 2:18:59 am PST -- JKF May 24, 1990 8:49:16 am PDT -- Michael Plass, September 5, 1991 10:40 pm PDT -- command: NPGS MPPass1T.pgs -- input: MPPass1T.pgs -- output: -- new version of MPPass1T.mesa -- table format description in MPParseTable.mesa -- table format implementation in MPParseTableImpl.mesa -- grammar on MPPass1T.grammar -- errors on MPPass1T.errlog DIRECTORY MPParseTable USING [ActionEntry, ProdDataRef], MPP1 USING [ ActionEntrySeq, IdOfFirst, IdOfLock, IdOfRest, InputLoc, INTSeq, Value, ValueStack], MPLeaves USING [HTIndex, HTNode, HTNull], MPTree USING [AttrId, Link, Map, NodeName, Null], MPTreeOps USING [ FreeTree, ListLength, MakeNode, ExtractTree, InsertTree, OpName, PopTree, PushTree, PushHash, PushList, PushLit, PushProperList, PushSe, PushNode, SetAttr, SetAttrs, SetInfo, SetSubInfo, UpdateList], Rope USING [ROPE]; MPPass1T: PROGRAM IMPORTS MPP1, MPTreeOps EXPORTS MPP1 = { OPEN MPTreeOps; -- parse tree building Op: TYPE = MPTree.NodeName; idANY: Rope.ROPE = "UNSPECIFIED"; idINTEGER: Rope.ROPE = "INTEGER"; idLOCK: Rope.ROPE = "LOCK"; -- local data base (supplied by parser) v: MPP1.ValueStack; l: REF MPP1.INTSeq; q: REF MPP1.ActionEntrySeq; prodData: MPParseTable.ProdDataRef; -- initialization/termination AssignDescriptors: PUBLIC PROC[ qd: REF MPP1.ActionEntrySeq, vd: MPP1.ValueStack, ld: REF MPP1.INTSeq, pp: MPParseTable.ProdDataRef] = { q ← qd; v ← vd; l ← ld; prodData ← pp; }; -- stack manipulation -- note that r, sb, and sn 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[VAL[v[k].sn], count]}; PushNegNodeV: PROC [k: NAT, count: INTEGER] = { PushNode[negation[VAL[v[k].sn]], count]; }; PushListV: PROC[k: NAT] = {PushList[v[k].sn]}; PushProperListV: PROC[k: NAT] = {PushProperList[v[k].sn]}; SetAttrV: PROC[attr: MPTree.AttrId, k: NAT] = {SetAttr[attr, v[k].sb]}; -- value manipulation negation: ARRAY Op[$relE .. $notin] OF Op = [ relE: $relN, relN: $relE, relL: $relGE, relGE: $relL, relG: $relLE, relLE: $relG, in: $notin, notin: $in]; BoolV: PROC [k: NAT] RETURNS [BOOL] = {RETURN [v[k].sb]}; SetBoolV: PROC [k: NAT, b: BOOL] = {v[k].sb ← b}; OpV: PROC [k: NAT] RETURNS [Op] = {RETURN [VAL[v[k].sn]]}; SetOpV: PROC [k: NAT, op: Op] = {v[k].sn ← op.ORD}; NegatedV: PROC [k: NAT] RETURNS [Op] = INLINE { RETURN [negation[VAL[v[k].sn]]]; }; -- shared processing routines DetachItem: MPTree.Map = TRUSTED {PushTree[t]; RETURN [MPTree.Null]}; AnonField: PROC[type, default: MPTree.Link, top: CARDINAL] = { PushField[MPLeaves.HTNull, type, default, top]}; PushField: PROC[id: MPLeaves.HTIndex, type, default: MPTree.Link, top: CARDINAL] = { PushHash[id]; PushTree[type]; PushTree[default]; PushNode[$decl,3]; LinkToSource[top]; SetAttrs[FALSE,public,FALSE]; }; PushHashString: PROC [s: Rope.ROPE] = { PushHash[NEW[MPLeaves.HTNode ← [index: -1, name: s]]]; }; -- the interpretation rules LinkToSource: PROC[index: CARDINAL] = {SetInfo[l[index]]}; -- propagated attributes public: BOOL ← FALSE; machineDep: BOOL ← FALSE; trusted, checked: BOOL ← FALSE; cedar: BOOL ← FALSE; safety: BOOL ← FALSE; ProcessQueue: PUBLIC PROC[qI, top: CARDINAL] = { t1, t2: MPTree.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 => -- TYPE: MPParseTable -- 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 RETURNS SAFE UNSAFE -- PACKED MSBIT LSBIT NATIVE WORD8 WORD16 WORD32 WORD64 -- 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 -- BITS BYTES SIZE UNITS WORDS -- 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 -- 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 -- ** tokenPOWER -- = tokenEQUAL -- => tokenARROW -- < tokenLESS -- <= tokenLE -- > tokenGREATER -- >= tokenGE -- # tokenNE -- ~ tokenTILDE -- ~~ tokenBIND -- . initialSymbol --PRODUCTIONS: -- goal ::= . module . -- goal ::= . module .. NULL; 1 => -- module ::= directory identlist cedar proghead trusted checked block -- module ::= directory identlist cedar defhead defbody {program: BOOL ← len = 7; IF ~BoolV[top+len-1] THEN InsertTree[MPTree.Null,2]; PushTree[MPTree.Null]; t1 ← MakeNode[$body,4]; t2 ← ExtractTree[2]; PushTree[ExtractTree[5]]; PushTree[t2]; PushTree[t1]; IF program THEN { 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]; }; 2 => -- includeitem ::= id : FROM string using {PushLitV[top+3]; PushHashV[top]; PushNode[$diritem,-3]; LinkToSource[top]; }; 3 => -- includeitem ::= id : TYPE using -- includeitem ::= id using -- includeitem ::= id : TYPE id using {IF len = 5 THEN PushHashV[top+3] ELSE PushTree[MPTree.Null]; PushHashV[top]; PushNode[$diritem,-3]; LinkToSource[top]; }; 4 => -- cedar ::= CEDAR -- cedar ::= cedar ← safety ← trusted ← checked ← (len = 1); 5 => -- proghead ::= resident safe class arguments locks interface bindop public {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 # MPTree.Null THEN PushTree[t1] ELSE { PushHash[MPP1.IdOfLock[]]; PushTree[MPTree.Null]; PushNode[$lambda,-2]; SetAttr[1,TRUE]; SetAttr[2,public]}; machineDep ← FALSE; }; 6 => -- resident ::= {public ← FALSE; SetBoolV[top,FALSE]; l[top] ← MPP1.InputLoc[] }; 7 => -- defhead ::= definitions locks imports shares bindop public {t1 ← ExtractTree[3]; t2 ← PopTree[]; PushTree[MPTree.Null]; PushTree[t2]; PushNode[$definitionTC,0]; PushTree[t1]; SetBoolV[top,FALSE]; machineDep ← FALSE; }; 8 => -- definitions ::= DEFINITIONS public ← TRUE; 9 => -- defbody ::= BEGIN open declist END -- defbody ::= BEGIN open declist ; END -- defbody ::= { open declist } -- defbody ::= { open declist ; } {PushListV[top+2]; PushTree[MPTree.Null]; SetBoolV[top,TRUE]}; 10 => -- locks ::= LOCKS primary lambda {PushNode[$lambda,-2]; SetAttr[1,FALSE]; SetAttr[2,FALSE]}; 11 => -- lambda ::= USING ident typeexp {PushTree[MPTree.Null]; PushNode[$decl,3]; LinkToSource[top+1]; SetAttrs[FALSE,FALSE,FALSE]; }; 12 => -- moduleitem ::= id -- moduleitem ::= id : id {PushHashV[top]; PushHashV[top+(len-1)]; PushNode[$item,2]; SetAttr[1,len = 3]; LinkToSource[top]}; 13 => -- declaration ::= identlist public entry readonly typeexp initialization {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]}; 14 => -- declaration ::= identlist public TYPE bindop public typeexp default {public ← BoolV[top+4]; PushNode[$typedecl,3]; LinkToSource[top]; SetAttrs[TRUE,public,FALSE]; public ← BoolV[top+1]}; 15 => -- declaration ::= identlist public TYPE optsize {PushNode[$opaqueTC,1]; PushTree[MPTree.Null]; PushNode[$typedecl,3]; LinkToSource[top]; SetAttrs[TRUE,public,FALSE]; public ← BoolV[top+1]}; 16 => -- public ::= PUBLIC {SetBoolV[top,public]; public ← TRUE}; 17 => -- public ::= PRIVATE -- procaccess ::= {SetBoolV[top, public]; public ← FALSE}; 18 => -- public ::= SetBoolV[top,public]; 19 => -- entry ::= ENTRY SetOpV[top,$entry]; 20 => -- entry ::= INTERNAL SetOpV[top,$internal]; 21 => -- entry ::= {SetOpV[top,$none]; l[top] ← MPP1.InputLoc[]}; 22 => -- idlist' ::= id -- identlist' ::= id : -- idlist' ::= id , idlist' -- identlist' ::= id , identlist' {PushHashV[top]; v[top].sn ← IF len <= 2 THEN -1 ELSE v[top+2].sn-1}; 23 => -- identlist' ::= id position : {PushHashV[top]; PushNode[$item,-2]; v[top].sn ← -1}; 24 => -- identlist' ::= id position , identlist' {PushTree[ExtractTree[-(v[top+3].sn-1)]]; PushHashV[top]; PushNode[$item,-2]; v[top].sn ← v[top+3].sn-1}; 25 => -- position ::= ( exp optbits ) PushNode[$item,2]; 26 => -- optbits ::= : bounds -- interval ::= [ bounds ] PushNode[$intCC,2]; 27 => -- interval ::= [ bounds ) PushNode[$intCO,2]; 28 => -- interval ::= ( bounds ] PushNode[$intOC,2]; 29 => -- interval ::= ( bounds ) PushNode[$intOO,2]; 30 => -- typeexp ::= id -- range ::= id -- typeid' ::= id . id {PushHashV[top]; IF len = 3 THEN {PushHashV[top+2]; PushNode[$dot,2]}}; 31 => -- typeid' ::= typeid' . id -- typeappl ::= typeappl . id {PushHashV[top+2]; PushNode[$dot,2]}; 32 => -- typeid ::= id id {PushHashV[top+1]; PushHashV[top]; PushNode[$dot,2]}; 33 => -- typeid ::= id typeid {PushHashV[top]; PushNode[$dot,2]}; 34 => -- typeappl ::= id length {PushHashV[top]; PushNode[$apply,-2]}; 35 => -- typeappl ::= typeid length -- typeappl ::= typeappl length PushNode[$apply,2]; 36 => -- typecons ::= interval -- typecons ::= id interval -- range ::= id interval {IF len = 1 THEN PushSe[idINTEGER] ELSE PushHashV[top]; PushNode[$subrangeTC,-2]; }; 37 => -- typecons ::= typeid interval -- range ::= typeid interval PushNode[$subrangeTC,2]; 38 => -- typecons ::= dependent { elementlist } {PushListV[top+2]; PushNode[$enumeratedTC,1]; SetAttr[1,public]; SetAttr[2,machineDep]; machineDep ← BoolV[top]; }; 39 => -- ident ::= id position : -- element ::= id ( exp ) {PushHashV[top]; PushNode[$item,-2]}; 40 => -- element ::= ( exp ) {PushHash[MPLeaves.HTNull]; PushNode[$item,-2]}; 41 => -- typecons ::= dependent monitored RECORD reclist {IF ~BoolV[top+1] THEN PushNode[$recordTC,1] ELSE { t1 ← PopTree[]; v[top+2].sn ← ListLength[t1]; t1 ← UpdateList[t1,DetachItem]; t1 ← FreeTree[t1]; PushList[v[top+2].sn+1]; PushNode[$monitoredTC,1]}; SetAttr[1,machineDep]; SetAttrV[2,top+3]; machineDep ← BoolV[top]; SetAttr[3,TRUE]; }; 42 => -- typecons ::= ordered base pointertype {t2 ← MakeNode[$pointerTC,1]; t1 ← PopTree[]; PushTree[t2]; SetAttrV[1,top]; SetAttrV[2,top+1]; SetAttrV[3,top+2]; IF t1 # MPTree.Null THEN {PushTree[t1]; PushNode[$subrangeTC,2]}; }; 43 => -- typecons ::= VAR typeexp {PushNode[$varTC,1]; SetAttrs[FALSE,FALSE,FALSE]}; 44 => -- typecons ::= REF readonly typeexp {PushNode[$refTC,1]; SetAttr[1,FALSE]; SetAttr[2,FALSE]; SetAttrV[3,top+1]; PushNode[$longTC,1]; }; 45 => -- typecons ::= REF readonly ANY -- typecons ::= REF {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]; }; 46 => -- typecons ::= LIST OF readonly typeexp {PushField[MPP1.IdOfFirst[], PopTree[], MPTree.Null, top]; PushField[MPP1.IdOfRest[], MakeNode[$linkTC,0], MPTree.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]; }; 47 => -- typecons ::= PACKED typecons -- variantpart ::= PACKED variantpart {PushNode[$optionTC,1]; SetSubInfo[packedOption]; }; 48 => -- typecons ::= MSBIT typecons {PushNode[$optionTC,1]; SetSubInfo[msbitOption]; }; 49 => -- typecons ::= LSBIT typecons {PushNode[$optionTC,1]; SetSubInfo[lsbitOption]; }; 50 => -- typecons ::= NATIVE typecons {PushNode[$optionTC,1]; SetSubInfo[nativeOption]; }; 51 => -- typecons ::= WORD8 typecons {PushNode[$optionTC,1]; SetSubInfo[word8Option]; }; 52 => -- typecons ::= WORD16 typecons {PushNode[$optionTC,1]; SetSubInfo[word16Option]; }; 53 => -- typecons ::= WORD8 {PushHashString["WORD8"]; }; 54 => -- typecons ::= WORD16 {PushHashString["WORD16"]; }; 55 => -- typecons ::= WORD32 {PushHashString["WORD32"]; }; 56 => -- typecons ::= WORD64 {PushHashString["WORD64"]; }; 57 => -- typecons ::= WORD32 typecons {PushNode[$optionTC,1]; SetSubInfo[word32Option]; }; 58 => -- typecons ::= WORD64 typecons {PushNode[$optionTC,1]; SetSubInfo[word64Option]; }; 59 => -- typecons ::= ARRAY indextype OF typeexp {PushNode[$arrayTC,2]}; 60 => -- typecons ::= DESCRIPTOR FOR readonly typeexp {PushNode[$arraydescTC,1]; SetAttrV[3,top+2]}; 61 => -- typecons ::= safe transfermode arguments {PushNodeV[top+1,2]; SetAttrV[3,top]}; 62 => -- safe ::= {SetBoolV[top,safety]; l[top] ← MPP1.InputLoc[]}; 63 => -- arglist ::= ANY -- returnlist ::= RETURNS ANY PushNode[$anyTC, 0]; 64 => -- typecons ::= id RELATIVE typeexp {PushHashV[top]; PushNode[$relativeTC,-2]}; 65 => -- typecons ::= typeid RELATIVE typeexp PushNode[$relativeTC,2]; 66 => -- typecons ::= heap ZONE {PushNode[$zoneTC,0]; SetAttrV[1,top]; SetAttr[2,FALSE]}; 67 => -- typecons ::= LONG typeexp PushNode[$longTC,1]; 68 => -- typecons ::= FRAME [ id ] {PushHashV[top+2]; PushNode[$frameTC,1]}; 69 => -- typecons ::= id PAINTED typeexp {PushHashV[top]; PushNode[$paintTC,-2]}; 70 => -- typecons ::= typeid PAINTED typeexp PushNode[$paintTC,2]; 71 => -- monitored ::= MONITORED {PushSe[idLOCK]; PushField[MPP1.IdOfLock[], PopTree[], MPTree.Null, top]; SetBoolV[top,TRUE]; }; 72 => -- dependent ::= -- dependent ::= MACHINE DEPENDENT {SetBoolV[top,machineDep]; IF len # 0 THEN machineDep ← TRUE}; 73 => -- reclist ::= [ ] -- reclist ::= NULL -- reclist ::= [ pairlist ] -- reclist ::= [ typelist ] {IF len < 3 THEN PushList[0] ELSE PushListV[top+1]; SetBoolV[top,FALSE]}; 74 => -- reclist ::= [ pairlist , variantpair ] {PushList[v[top+1].sn+1]; SetBoolV[top,TRUE]}; 75 => -- reclist ::= [ variantpart default ] {t1 ← PopTree[]; AnonField[PopTree[], t1, top]; SetBoolV[top,TRUE]}; 76 => -- variantpart ::= SELECT vcasehead FROM variantlist ENDCASE -- variantpart ::= SELECT vcasehead FROM variantlist , ENDCASE {PushListV[top+3]; PushNode[$unionTC,2]; SetAttr[1,machineDep]; SetAttrV[2,top+1]; }; 77 => -- variantpart ::= SEQUENCE vcasehead OF typeexp {PushNode[$sequenceTC,2]; SetAttr[1,machineDep]; SetAttrV[2,top+1]; }; 78 => -- vcasehead ::= ident public tagtype -- pairitem ::= identlist public typeexp default -- variantpair ::= identlist public variantpart default {IF len = 3 THEN PushTree[MPTree.Null]; PushNode[$decl,3]; LinkToSource[top]; SetAttrs[FALSE,public,FALSE]; public ← BoolV[top+1]; IF len = 3 THEN SetBoolV[top,FALSE]; }; 79 => -- vcasehead ::= COMPUTED tagtype {AnonField[PopTree[], MPTree.Null, top]; SetBoolV[top,FALSE]}; 80 => -- vcasehead ::= OVERLAID tagtype {AnonField[PopTree[], MPTree.Null, top]; SetBoolV[top,TRUE]}; 81 => -- tagtype ::= * PushNode[$implicitTC,0]; 82 => -- variantitem ::= idlist => reclist {PushNode[$variantTC,1]; SetAttr[1,machineDep]; SetAttrV[2,top+2]; SetAttr[3,TRUE]; PushTree[MPTree.Null]; PushNode[$typedecl,3]; LinkToSource[top]; SetAttrs[TRUE,public,FALSE]; }; 83 => -- typelist ::= id -- typelist ::= typecons default -- typelist ::= typeid default -- typelist ::= id ← defaultopt {SELECT len FROM 1 => {PushHashV[top]; t1 ← MPTree.Null}; 2 => t1 ← PopTree[]; 3 => {t1 ← PopTree[]; PushHashV[top]}; ENDCASE => ERROR; AnonField[PopTree[], t1, top]; v[top].sn ← -1; }; 84 => -- typelist ::= typecons default , typelist -- typelist ::= typeid default , typelist {t1 ← ExtractTree[-(v[top+3].sn-1)]; AnonField[ExtractTree[-(v[top+3].sn-1)], t1, top]; v[top].sn ← v[top+3].sn-1; }; 85 => -- typelist ::= id , typelist -- typelist ::= id ← defaultopt , typelist {t1 ← IF len = 5 THEN ExtractTree[-(v[top+4].sn-1)] ELSE MPTree.Null; PushHashV[top]; AnonField[PopTree[], t1, top]; v[top].sn ← v[top+len-1].sn-1; }; 86 => -- pointertype ::= pointerprefix {PushSe[idANY]; SetBoolV[top,FALSE]}; 87 => -- pointertype ::= pointerprefix TO readonly typeexp SetBoolV[top, BoolV[top+2]]; 88 => -- transfermode ::= PROCEDURE -- transfermode ::= PROC SetOpV[top,$procTC]; 89 => -- transfermode ::= PORT SetOpV[top,$portTC]; 90 => -- transfermode ::= SIGNAL SetOpV[top,$signalTC]; 91 => -- transfermode ::= ERROR SetOpV[top,$errorTC]; 92 => -- transfermode ::= PROCESS SetOpV[top,$processTC]; 93 => -- transfermode ::= PROGRAM SetOpV[top,$programTC]; 94 => -- initialization ::= {PushTree[MPTree.Null]; SetBoolV[top,FALSE]}; 95 => -- initvalue ::= procaccess trusted checked inline entry block {IF ~BoolV[top+5] THEN InsertTree[MPTree.Null,2]; PushTree[MPTree.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]; }; 96 => -- initvalue ::= CODE PushNode[$signalinit,0]; 97 => -- initvalue ::= procaccess trusted checked MACHINE CODE BEGIN codelist END -- initvalue ::= procaccess trusted checked MACHINE CODE { codelist } {PushProperListV[top+6]; PushNode[$inline,1]; SetAttr[1,checked]; SetAttr[2,trusted]; trusted ← BoolV[top+1]; checked ← BoolV[top+2]; public ← BoolV[top]; }; 98 => -- trusted ::= SetBoolV[top,trusted]; 99 => -- codelist ::= orderlist -- codelist ::= codelist ; orderlist {PushListV[top+len-1]; v[top].sn ← IF len = 1 THEN 1 ELSE v[top].sn+1}; -- STATEMENT PROCESSING 100 => -- statement ::= IF exp THEN statement {PushTree[MPTree.Null]; PushNode[$if,3]; LinkToSource[top]}; 101 => -- statement ::= IF exp THEN balstmt ELSE statement -- balstmt ::= IF exp THEN balstmt ELSE balstmt {PushNode[$if,3]; LinkToSource[top]}; 102 => -- statement ::= casehead casestmtlist ENDCASE => statement -- balstmt ::= casehead casestmtlist ENDCASE => balstmt {t1 ← PopTree[]; PushProperListV[top+1]; PushTree[t1]; IF BoolV[top] THEN PushNode[$bind,4] ELSE PushNode[$case,3]; LinkToSource[top]}; 103 => -- basicstmt ::= lhs {PushTree[t1 ← PopTree[]]; IF OpName[t1] # $apply THEN { PushTree[MPTree.Null]; PushNode[$apply,2]; SetAttr[1, FALSE]}; LinkToSource[top]; }; 104 => -- basicstmt ::= lhs ← exp {PushNode[$assign,2]; LinkToSource[top]}; 105 => -- basicstmt ::= [ explist ] ← exp {PushNode[$extract,2]; LinkToSource[top]}; 106 => -- basicstmt ::= trusted checked block {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 # MPTree.Null THEN { PushTree[t1]; PushNode[$open,-2]; LinkToSource[top+2]}; }; 107 => -- basicstmt ::= casehead casestmtlist ENDCASE {PushProperListV[top+1]; PushTree[MPTree.Null]; IF BoolV[top] THEN PushNode[$bind,4] ELSE PushNode[$case,3]; LinkToSource[top]; }; 108 => -- basicstmt ::= forclause dotest DO scope doexit ENDLOOP {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]; }; 109 => -- basicstmt ::= EXIT {PushNode[$exit,0]; LinkToSource[top]}; 110 => -- basicstmt ::= LOOP {PushNode[$loop,0]; LinkToSource[top]}; 111 => -- basicstmt ::= GOTO id -- basicstmt ::= GO TO id {PushHashV[top+len-1]; PushNode[$goto,1]; LinkToSource[top]}; 112 => -- basicstmt ::= RETURN optargs {PushNode[$return,1]; SetAttrV[3,top+1]; LinkToSource[top]}; 113 => -- basicstmt ::= transfer lhs {PushNodeV[top,1]; LinkToSource[top]}; 114 => -- basicstmt ::= free [ exp optcatch ] {IF BoolV[top+3] THEN { t1 ← PopTree[]; PushTree[MPTree.Null]; PushTree[t1]; PushNode[$free,4]} ELSE {PushTree[MPTree.Null]; PushNode[$free,3]}; LinkToSource[top]}; 115 => -- basicstmt ::= WAIT lhs {PushNode[$wait,1]; LinkToSource[top]}; 116 => -- basicstmt ::= ERROR {PushNode[$syserror,0]; LinkToSource[top]}; 117 => -- basicstmt ::= STOP {PushNode[$stop,0]; LinkToSource[top]}; 118 => -- basicstmt ::= NULL {PushNode[$null,0]; LinkToSource[top]}; 119 => -- basicstmt ::= RESUME optargs {PushNode[$resume,1]; SetAttrV[3,top+1]; LinkToSource[top]}; 120 => -- basicstmt ::= REJECT {PushNode[$reject,0]; LinkToSource[top]}; 121 => -- basicstmt ::= CONTINUE {PushNode[$continue,0]; LinkToSource[top]}; 122 => -- basicstmt ::= RETRY {PushNode[$retry,0]; LinkToSource[top]}; 123 => -- 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]]; 124 => -- scope ::= open enables statementlist {PushListV[top+2]; SetBoolV[top,FALSE]; IF BoolV[top+1] THEN {PushNode[$enable,2]; LinkToSource[top+1]}; }; 125 => -- scope ::= open enables declist ; statementlist {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]; }; 126 => -- binditem ::= exp -- binditem ::= id ~~ exp -- binditem ::= id : exp {IF len = 1 THEN PushHash[MPLeaves.HTNull] ELSE PushHashV[top]; PushNode[$item,-2]; LinkToSource[top]; }; 127 => -- exits ::= EXITS exitlist {PushListV[top+1]; SetBoolV[top,TRUE]}; 128 => -- casestmtitem ::= caselabel => statement -- caseexpitem ::= caselabel => exp -- exititem ::= idlist => statement {PushNode[$item,2]; LinkToSource[top]}; 129 => -- casetest ::= optrelation -- casetest ::= ~ optrelation {PushTree[MPTree.Null]; IF len = 1 THEN PushNodeV[top,-2] ELSE PushNegNodeV[top+1,-2]}; 130 => -- casetest ::= exp {PushTree[MPTree.Null]; PushNode[$relE,-2]}; 131 => -- caselabel ::= ident typeexp -- controlid ::= ident typeexp {PushTree[MPTree.Null]; PushNode[$cast,1]; PushNode[$decl,3]; LinkToSource[top]; SetAttrs[FALSE,public,FALSE]; }; 132 => -- forclause ::= FOR controlid ← exp , exp PushNode[$forseq,3]; 133 => -- forclause ::= FOR controlid direction IN range {PushTree[MPTree.Null]; PushNodeV[top+2,3]}; 134 => -- forclause ::= THROUGH range {InsertTree[MPTree.Null,2]; PushTree[MPTree.Null]; PushNode[$upthru,-3]}; 135 => -- direction ::= -- direction ::= DECREASING SetOpV[top,IF len = 0 THEN $upthru ELSE $downthru]; 136 => -- dotest ::= UNTIL exp PushNode[$not,1]; 137 => -- doexit ::= -- doexit ::= REPEAT exitlist {IF len = 0 THEN PushTree[MPTree.Null] ELSE PushListV[top+1]; PushTree[MPTree.Null]; }; 138 => -- doexit ::= REPEAT exitlist FINISHED => statement -- doexit ::= REPEAT exitlist FINISHED => statement ; {t1 ← PopTree[]; PushListV[top+1]; PushTree[t1]}; 139 => -- enables ::= ENABLE catchcase ; {PushTree[MPTree.Null]; PushNode[$catch,2]; SetBoolV[top,TRUE]}; 140 => -- enables ::= ENABLE catchany ; {PushTree[MPTree.Null]; PushNode[$catch,-2]; SetBoolV[top,TRUE]}; 141 => -- enables ::= ENABLE BEGIN catchlist END ; -- enables ::= ENABLE { catchlist } ; {t1 ← PopTree[]; PushListV[top+2]; PushTree[t1]; PushNode[$catch,2]; SetBoolV[top,TRUE]}; 142 => -- catchlist ::= catchhead catchcase {v[top].sn ← v[top].sn + 1; PushTree[MPTree.Null]}; 143 => -- catchcase ::= lhslist => statement {t1 ← PopTree[]; PushListV[top]; PushTree[t1]; PushNode[$item,2]; LinkToSource[top]; }; 144 => -- optargs ::= [ explist ] {t1 ← PopTree[]; IF t1 = MPTree.Null THEN PushProperList[0] ELSE PushTree[t1]; SetBoolV[top,FALSE]; }; 145 => -- optargs ::= {PushTree[MPTree.Null]; l[top] ← MPP1.InputLoc[]; SetBoolV[top,FALSE]}; 146 => -- transfer ::= SIGNAL SetOpV[top,$signal]; 147 => -- transfer ::= ERROR SetOpV[top,$error]; 148 => -- transfer ::= RETURN WITH ERROR SetOpV[top,$xerror]; 149 => -- transfer ::= START SetOpV[top,$start]; 150 => -- transfer ::= RESTART SetOpV[top,$restart]; 151 => -- transfer ::= JOIN SetOpV[top,$join]; 152 => -- transfer ::= NOTIFY SetOpV[top,$notify]; 153 => -- transfer ::= BROADCAST SetOpV[top,$broadcast]; -- EXPRESSION PROCESSING 154 => -- keyitem ::= id ~ optexp -- keyitem ::= id : optexp {PushHashV[top]; PushNode[$item,-2]}; 155 => -- defaultopt ::= trash -- optexp ::= trash -- initvalue ::= trash -- defaultopt ::= exp '| trash {PushNode[$void,0]; IF len # 1 THEN PushList[2]}; 156 => -- exp ::= IF exp THEN exp ELSE exp PushNode[$ifx,3]; 157 => -- exp ::= casehead caseexplist ENDCASE => exp {t1 ← PopTree[]; PushProperListV[top+1]; PushTree[t1]; IF BoolV[top] THEN PushNode[$bindx,4] ELSE PushNode[$casex,3]; LinkToSource[top]; }; 158 => -- exp ::= lhs ← exp PushNode[$assignx,2]; 159 => -- exp ::= [ explist ] ← exp PushNode[$extractx,2]; 160 => -- exp ::= ERROR PushNode[$syserrorx,0]; 161 => -- disjunct ::= disjunct OR conjunct PushNode[$or,2]; 162 => -- conjunct ::= conjunct AND negation PushNode[$and,2]; 163 => -- negation ::= ~ relation -- negation ::= NOT relation PushNode[$not,1]; 164 => -- relation ::= sum optrelation -- sum ::= sum addop product -- product ::= product multop factor PushNodeV[top+1,2]; 165 => -- optrelation ::= NOT relationtail SetOpV[top, NegatedV[top+1]]; 166 => -- relationtail ::= IN range SetOpV[top,$in]; 167 => -- relop ::= = SetOpV[top,$relE]; 168 => -- relop ::= # SetOpV[top,$relN]; 169 => -- relop ::= < SetOpV[top,$relL]; 170 => -- relop ::= <= SetOpV[top,$relLE]; 171 => -- relop ::= > SetOpV[top,$relG]; 172 => -- relop ::= >= SetOpV[top,$relGE]; 173 => -- addop ::= + SetOpV[top,$plus]; 174 => -- addop ::= - SetOpV[top,$minus]; 175 => -- multop ::= * SetOpV[top,$times]; 176 => -- multop ::= / SetOpV[top,$div]; 177 => -- multop ::= MOD SetOpV[top,$mod]; 178 => -- factor ::= primary ** factor PushNode[$power,2]; 179 => -- factor ::= addop primary IF OpV[top] = $minus THEN PushNode[$uminus,1]; 180 => -- primary ::= [ explist ] {PushTree[MPTree.Null]; PushNode[$apply,-2]; SetAttr[1, FALSE]}; 181 => -- primary ::= prefixop [ orderlist ] {PushListV[top+2]; PushNodeV[top,1]}; 182 => -- primary ::= VAL [ orderlist ] {PushListV[top+2]; PushNode[$val,1]}; 183 => -- primary ::= ALL [ orderlist ] {PushListV[top+2]; PushNode[$all,1]}; 184 => -- primary ::= new [ typeexp initialization optcatch ] {PushNode[$new, IF BoolV[top+4] THEN 4 ELSE 3]; SetAttrV[1,top+3]}; 185 => -- primary ::= cons [ explist optcatch ] PushNode[$cons, IF BoolV[top+3] THEN 3 ELSE 2]; 186 => -- primary ::= listcons [ explist ] PushNode[$listcons,2]; 187 => -- primary ::= NIL {PushTree[MPTree.Null]; PushNode[$nil,1]}; 188 => -- primary ::= typeop [ typeexp ] -- exp ::= transferop lhs PushNodeV[top,1]; 189 => -- qualifier ::= . prefixop -- qualifier ::= . typeop PushNodeV[top+1,1]; 190 => -- primary ::= BITS [ typeexp ] -- qualifier ::= . BITS -- primary ::= BITS [ typeexp , exp ] {IF len < 5 THEN PushTree[MPTree.Null]; PushNode[$size,2]; SetSubInfo[packedOption]}; 191 => -- primary ::= BYTES [ typeexp ] -- qualifier ::= . BYTES -- primary ::= BYTES [ typeexp , exp ] {IF len < 5 THEN PushTree[MPTree.Null]; PushNode[$size,2]; SetSubInfo[msbitOption]}; 192 => -- primary ::= UNITS [ typeexp ] -- qualifier ::= . UNITS -- primary ::= UNITS [ typeexp , exp ] {IF len < 5 THEN PushTree[MPTree.Null]; PushNode[$size,2]; SetSubInfo[lsbitOption]}; 193 => -- primary ::= SIZE [ typeexp ] -- qualifier ::= . SIZE -- primary ::= SIZE [ typeexp , exp ] {IF len < 5 THEN PushTree[MPTree.Null]; PushNode[$size,2]; SetSubInfo[lsbitOption]}; 194 => -- primary ::= WORDS [ typeexp ] -- qualifier ::= . WORDS -- primary ::= WORDS [ typeexp , exp ] {IF len < 5 THEN PushTree[MPTree.Null]; PushNode[$size,2]; SetSubInfo[nativeOption]}; 195 => -- primary ::= ISTYPE [ exp , typeexp ] PushNode[$istype,2]; 196 => -- primary ::= @ lhs PushNode[$addr,1]; 197 => -- primary ::= DESCRIPTOR [ desclist ] PushNode[$arraydesc,1]; 198 => -- lhs ::= id -- element ::= id -- ident ::= id : -- controlid ::= id PushHashV[top]; 199 => -- lhs ::= num -- lhs ::= string -- lhs ::= lnum PushLitV[top]; 200 => -- lhs ::= flnum {PushLitV[top]; PushNode[$float,1]}; 201 => -- lhs ::= char {PushLitV[top]; PushNode[$clit,1]}; 202 => -- lhs ::= lstring {PushLitV[top]; PushNode[$llit,1]}; 203 => -- lhs ::= atom {PushHashV[top]; PushNode[$atom,1]}; 204 => -- lhs ::= NARROW [ exp opttype optcatch ] PushNode[$narrow, IF BoolV[top+4] THEN 3 ELSE 2]; 205 => -- lhs ::= LOOPHOLE [ exp opttype ] PushNode[$loophole,2]; 206 => -- lhs ::= APPLY [ exp , exp optcatch ] {PushNode[$apply, IF BoolV[top+5] THEN 3 ELSE 2]; SetAttr[1,TRUE]}; 207 => -- qualifier ::= [ explist optcatch ] {PushNode[$apply, IF BoolV[top+2] THEN 3 ELSE 2]; SetAttr[1,FALSE]}; 208 => -- qualifier ::= . id {PushHashV[top+1]; PushNode[$dot,2]}; 209 => -- qualifier ::= ↑ PushNode[$uparrow,1]; 210 => -- optcatch ::= ! catchlist {t1 ← PopTree[]; PushListV[top+1]; PushTree[t1]; PushNode[$catch,2]; SetBoolV[top,TRUE]; }; 211 => -- transferop ::= SIGNAL SetOpV[top,$signalx]; 212 => -- transferop ::= ERROR SetOpV[top,$errorx]; 213 => -- transferop ::= START SetOpV[top,$startx]; 214 => -- transferop ::= JOIN SetOpV[top,$joinx]; 215 => -- transferop ::= NEW SetOpV[top,$create]; 216 => -- transferop ::= FORK SetOpV[top,fork]; 217 => -- prefixop ::= LONG SetOpV[top,$lengthen]; 218 => -- prefixop ::= ABS SetOpV[top,$abs]; 219 => -- prefixop ::= PRED SetOpV[top,$pred]; 220 => -- prefixop ::= SUCC SetOpV[top,$succ]; 221 => -- prefixop ::= ORD SetOpV[top,$ord]; 222 => -- prefixop ::= MIN SetOpV[top,$min]; 223 => -- prefixop ::= MAX SetOpV[top,$max]; 224 => -- prefixop ::= BASE SetOpV[top,$base]; 225 => -- prefixop ::= LENGTH SetOpV[top,$length]; 226 => -- typeop ::= CODE SetOpV[top,$typecode]; 227 => -- typeop ::= FIRST SetOpV[top,$first]; 228 => -- typeop ::= LAST SetOpV[top,$last]; 229 => -- typeop ::= NIL SetOpV[top,$nil]; 230 => -- desclist ::= exp , exp opttype PushList[3]; 231 => -- directory ::= DIRECTORY ; -- imports ::= IMPORTS -- exports ::= EXPORTS -- fieldlist ::= [ ] -- new ::= NEW -- free ::= FREE -- cons ::= CONS -- listcons ::= LIST -- pointerprefix ::= POINTER -- catchlist ::= catchhead PushTree[MPTree.Null]; 232 => -- using ::= USING [ ] -- defaultopt ::= PushProperList[0]; 233 => -- 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 -- 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].sn ← IF len <= 1 THEN len ELSE v[top].sn+1; 234 => -- 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] ELSE PushListV[top+1]; 235 => -- class ::= PROGRAM -- safe ::= UNSAFE -- initialization ::= ← initvalue -- casehead ::= SELECT exp FROM SetBoolV[top,FALSE]; 236 => -- class ::= MONITOR -- 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 -- readonly ::= -- monitored ::= -- ordered ::= -- base ::= -- heap ::= -- inline ::= -- enables ::= -- exits ::= -- optcatch ::= IF len = 0 THEN {SetBoolV[top,FALSE]; l[top] ← MPP1.InputLoc[]} ELSE SetBoolV[top,TRUE]; 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 -- directory ::= -- using ::= -- locks ::= -- lambda ::= -- imports ::= -- exports ::= -- shares ::= -- optsize ::= -- optbits ::= -- default ::= -- open ::= -- arglist ::= -- returnlist ::= -- indextype ::= -- forclause ::= -- dotest ::= -- optexp ::= -- opttype ::= IF len = 0 THEN {PushTree[MPTree.Null]; l[top] ← MPP1.InputLoc[]}; 238 => -- checked ::= {SetBoolV[top,checked]; trusted ← checked}; 239 => -- checked ::= CHECKED {SetBoolV[top,checked]; trusted ← checked ← TRUE}; 240 => -- checked ::= TRUSTED {SetBoolV[top,checked]; trusted ← TRUE; checked ← FALSE}; 241 => -- checked ::= UNCHECKED {SetBoolV[top,checked]; trusted ← checked ← FALSE}; -- error or unimplemented ENDCASE => ERROR; ENDLOOP; }; }. .