|
|
1.1 ! root 1: static char tab_c_Sccsid[] = "tab.c @(#)tab.c 1.3 10/5/82 Berkeley "; ! 2: ! 3: /* ! 4: * This table defines the operators in APL\11. ! 5: * The first entry is the character representing ! 6: * the operator, the second is the unique operator ! 7: * identifier (which should give you a hint as ! 8: * to what the operator is), and the third is ! 9: * the operator type, of interest only to the ! 10: * interpreter. ! 11: * Those characters represented by octal numbers are actually ! 12: * two-character overstrikes. Ignore the leading "2", and ! 13: * the rest of the number is an index into "chartab", below, ! 14: * which lists the two-character overstrikes. Overstrikes ! 15: * may be in either order. ! 16: * ! 17: * Note: What isn't shown here is that unary minus ! 18: * is ` (backwards apostrophe). This is handled in lex.c, a0.c ! 19: * and a2.c (both input and output). ! 20: */ ! 21: struct tab ! 22: { ! 23: int input; ! 24: int lexval; ! 25: int retval; ! 26: } tab[] = { ! 27: ! 28: /* ! 29: * one of a kind ! 30: */ ! 31: ! 32: '(', unk,lpar, ! 33: ')', unk,rpar, ! 34: '[', unk,lbkt, ! 35: ']', unk,rbkt, ! 36: '/', COM,com, ! 37: 0200 , COM0,com0, ! 38: '\\', EXD,com, ! 39: 0201 , EXD0,com0, ! 40: '\'', unk,strng, ! 41: 'J', unk,null, ! 42: '.', IPROD,dot, ! 43: 'L', QUAD,Quad, ! 44: 0202 , QQUAD,Quad, ! 45: 0203 , CQUAD,Quad, ! 46: ';', unk,semi, ! 47: ':', unk,cln, ! 48: 0204 , COMNT,comnt, ! 49: 'C', COMNT,comnt, ! 50: '}', BRAN0,tran, ! 51: ! 52: /* ! 53: * dyadic scalars ! 54: * op2 op1 v (dyadic op) ! 55: */ ! 56: ! 57: '<', LT,dscal, ! 58: '>', GT,dscal, ! 59: '$', LE,dscal, ! 60: 0220, LE,dscal, ! 61: '&', GE,dscal, ! 62: 0221, GE,dscal, ! 63: '=', EQ,dscal, ! 64: '#', NE,dscal, ! 65: 0222, NE,dscal, ! 66: '^', AND,dscal, ! 67: 'A', AND,dscal, ! 68: 'Q', OR,dscal, ! 69: 'V', OR,dscal, ! 70: 0205 , NAND,dscal, ! 71: 0231, NAND,dscal, ! 72: 0206 , NOR,dscal, ! 73: 0223, NAND,dscal, ! 74: 0224, NOR,dscal, ! 75: ! 76: /* ! 77: * monadic or dyadic scalars ! 78: * op2 op1 v (dyadic op) ! 79: * op1 v+1 (monadic op) ! 80: */ ! 81: ! 82: '+', ADD,mdscal, ! 83: '-', SUB,mdscal, ! 84: 'M', MUL,mdscal, ! 85: 'X', MUL,mdscal, ! 86: 0225, MUL,mdscal, ! 87: 'P', DIV,mdscal, ! 88: 0240, DIV,mdscal, ! 89: '%', DIV,mdscal, ! 90: 0226, DIV,mdscal, ! 91: '|', MOD,mdscal, ! 92: 'D', MIN,mdscal, ! 93: 'S', MAX,mdscal, ! 94: '*', PWR,mdscal, ! 95: 0207 , LOG,mdscal, ! 96: 'O', CIR,mdscal, ! 97: 0210 , COMB,mdscal, ! 98: '!', COMB,mdscal, ! 99: ! 100: /* ! 101: * monadic ! 102: * op1 v (monadic op) ! 103: */ ! 104: ! 105: '~', NOT,m, ! 106: 0241, EPS+1,m, ! 107: /* ! 108: * dyadic ! 109: * op2 op1 v (dyadic op) ! 110: */ ! 111: ! 112: 'N', REP,d, ! 113: 'Y', TAKE,d, ! 114: 'U', DROP,d, ! 115: '_', ASGN,asg, ! 116: '{', ASGN,asg, ! 117: ! 118: /* ! 119: * monadic or dyadic ! 120: * op2 op1 v (dyadic op) ! 121: * op1 v+1 (monadic op) ! 122: */ ! 123: ! 124: 'E', EPS,md, ! 125: 'B', BASE,md, ! 126: '?', DEAL,md, ! 127: 'R', DRHO,md, ! 128: 'I', DIOT,md, ! 129: 0211 , ROT0,md, ! 130: 0212 , DTRN,md, ! 131: 0213 , DIBM,md, ! 132: 0214 , DDOM,md, ! 133: 0242, DFMT,md, ! 134: ! 135: ! 136: ! 137: /* ! 138: * monadic with optional subscript ! 139: * op1 v (monadic op) ! 140: * op1 sub v+1 (subscripted monadic op) ! 141: */ ! 142: ! 143: 0215 , GDU,msub, ! 144: 0216 , GDD,msub, ! 145: 0227, GDU,msub, ! 146: 0230, GDD,msub, ! 147: ! 148: /* ! 149: * dyadic with optional subscript ! 150: * op2 op1 v (dyadic op) ! 151: * op2 op1 sub v+1 (subscripted dyadic op) ! 152: */ ! 153: ! 154: ! 155: /* ! 156: * monadic or dyadic with optional subscript ! 157: * op2 op1 v (dyadic op) ! 158: * op1 v+1 (monadic op) ! 159: * op2 op1 sub v+2 (subscripted dyadic op) ! 160: * op1 sub v+3 (subscripted monadic op) ! 161: */ ! 162: ! 163: 0217 , ROT,mdsub, ! 164: ',', CAT,mdsub, ! 165: ! 166: /* ! 167: * ISP and PSI ! 168: */ ! 169: 0232, PSI,d, ! 170: 0233, ISP,d, ! 171: ! 172: /* ! 173: * other, non-function ! 174: */ ! 175: 0234, unk,null, ! 176: 0235, unk,null, ! 177: 0236, unk,null, ! 178: 0237, unk,null, ! 179: '@', unk,null, ! 180: ! 181: /* ! 182: * end of list ! 183: */ ! 184: ! 185: 0 ! 186: }; ! 187: ! 188: struct { ! 189: char *ct_name; /* command name string */ ! 190: int ct_ytype; /* command type */ ! 191: int ct_ylval; /* "yylval" value */ ! 192: } comtab[] = { ! 193: "clear", comnull, CLEAR, ! 194: "continue", comnull, CONTIN, ! 195: "copy", comnam, COPY, ! 196: "debug", comnull, DEBUG, ! 197: "digits", comexpr, DIGITS, ! 198: "drop", comlist, DROPC, ! 199: "edit", comnam, EDIT, ! 200: "editf", comnam, EDITF, ! 201: "write", comnam, WRITE, ! 202: "trace", comnull, TRACE, ! 203: "untrace", comnull, UNTRACE, ! 204: "erase", comlist, ERASE, ! 205: "fns", comnull, FNS, ! 206: "fuzz", comexpr, FUZZ, ! 207: "lib", comnull, LIB, ! 208: "load", comnam, LOAD, ! 209: "off", comnull, OFF, ! 210: "origin", comexpr, ORIGIN, ! 211: "read", comnam, READ, ! 212: "save", comnam, SAVE, ! 213: "vars", comnull, VARS, ! 214: "width", comexpr, WIDTH, ! 215: "vsave", comnam, VSAVE, ! 216: "script", comnam, SCRIPT, ! 217: "reset", comnull, RESET, ! 218: "si", comnull, SICOM, ! 219: "code", comnam, CODE, ! 220: "del", comnam, DEL, ! 221: "shell", comnull, SHELL, ! 222: "list", comnam, LIST, ! 223: "prws", comnull, PRWS, ! 224: 0, unk ! 225: }; ! 226: ! 227: /* ! 228: * List of two-character escapes. Indexed by 02XX entries ! 229: * in "tab", above. Entries must be in lexical order, i.e. ! 230: * 'V~' will work, '~V' will not (since overstrikes are ! 231: * sorted before they are looked up). 'V~' is 6 down in ! 232: * the table, and thus corresponds to 0206, ! 233: * which "tab" shows to be NOR. ! 234: */ ! 235: int chartab[] = { ! 236: ! 237: '-/', /* 0200 comprs */ ! 238: '-\\', /* 0201 expand */ ! 239: '\'L', /* 0202 quote quad */ ! 240: 'LO', /* 0203 circle quad */ ! 241: 'CJ', /* 0204 lamp */ ! 242: '^~', /* 0205 nand */ ! 243: 'V~', /* 0206 nor */ ! 244: '*O', /* 0207 log */ ! 245: '\'.', /* 0210 comb/fact ('!') */ ! 246: '-O', /* 0211 rotate */ ! 247: 'O\\', /* 0212 transpose */ ! 248: 'BN', /* 0213 i beam */ ! 249: '%L', /* 0214 domino */ ! 250: 'A|', /* 0215 grade up */ ! 251: 'V|', /* 0216 grade dn */ ! 252: 'O|', /* 0217 rotate */ ! 253: '<=', /* 0220 less eq */ ! 254: '=>', /* 0221 greater eq */ ! 255: '/=', /* 0222 not eq */ ! 256: 'A~', /* 0223 nand */ ! 257: 'Q~', /* 0224 nor */ ! 258: '/\\', /* 0225 multiply */ ! 259: '-:', /* 0226 divide */ ! 260: 'H|', /* 0227 another grade up */ ! 261: 'G|', /* 0230 another dgrade dn */ ! 262: '&~', /* 0231 yet another nand */ ! 263: 'U|', /* 0232 PSI */ ! 264: 'C|', /* 0233 ISP */ ! 265: 'Y~', /* 0234 bracket 1 */ ! 266: 'U~', /* 0235 bracket 2 */ ! 267: '-U', /* 0236 another bracket 2 */ ! 268: '-Y', /* 0237 another bracket 2 */ ! 269: '//', /* 0240 alternate divide */ ! 270: 'BJ', /* 0241 standard execute */ ! 271: 'JN', /* 0242 format */ ! 272: /* ! 273: * function alpha() in lex.c must be changed whenever this ! 274: * table is updated. It must know the index of the alternate ! 275: * character set (currently 0243) ! 276: */ ! 277: 'Fa', /* alternate character set */ ! 278: 'Fb', ! 279: 'Fc', ! 280: 'Fd', ! 281: 'Fe', ! 282: 'Ff', ! 283: 'Fg', ! 284: 'Fh', ! 285: 'Fi', ! 286: 'Fj', ! 287: 'Fk', ! 288: 'Fl', ! 289: 'Fm', ! 290: 'Fn', ! 291: 'Fo', ! 292: 'Fp', ! 293: 'Fq', ! 294: 'Fr', ! 295: 'Fs', ! 296: 'Ft', ! 297: 'Fu', ! 298: 'Fv', ! 299: 'Fw', ! 300: 'Fx', ! 301: 'Fy', ! 302: 'Fz', ! 303: 0 ! 304: }; ! 305: ! 306: /* ! 307: * qtab -- table of valid quad functions ! 308: * the format of the qtab is the similar to tab, above ! 309: * ! 310: */ ! 311: struct qtab{ ! 312: char *qname; ! 313: int qtype; ! 314: int rtype; ! 315: } qtab[] = { ! 316: ! 317: "lx", XQUAD, Quad, ! 318: "width", QWID, Quad, ! 319: "run", QRUN, m, ! 320: "fuzz", QFUZZ, Quad, ! 321: "fork", QFORK, m, ! 322: "wait", QWAIT, m, ! 323: "exec", QEXEC, m, ! 324: "cr", QCRP, m, ! 325: "fx", FDEF, m, ! 326: "exit", QEXIT, m, ! 327: "pipe", QPIPE, m, ! 328: "chdir",QCHDIR, m, ! 329: "open", QOPEN, d, ! 330: "close", QCLOSE, m, ! 331: "read", QREAD, d, ! 332: "write",QWRITE, d, ! 333: "creat",QCREAT, d, ! 334: "seek", QSEEK, m, ! 335: "kill", QKILL, d, ! 336: "rd", QRD, m, ! 337: "rm", QUNLNK, m, ! 338: "dup", QDUP, m, ! 339: "ap", QAP, d, ! 340: "rline",QRD, m, ! 341: "nc", QNC, m, ! 342: "sig", QSIGNL, d, ! 343: "float",QFLOAT, m, ! 344: "nl" ,QNL, m, ! 345: 0};
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.