home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V6 / usr / source / c / c05.c < prev    next >
Encoding:
C/C++ Source or Header  |  1975-07-18  |  4.2 KB  |  177 lines

  1. #
  2. #include "c0h.c"
  3. /*
  4.  *  info on operators:
  5.  *   01-- is binary operator
  6.  *   02-- left (or only) operand must be lvalue
  7.  *   04-- is relational operator
  8.  *  010-- is assignment-type operator
  9.  *  020-- non-float req. on left
  10.  *  040-- non-float req. on right
  11.  * 0100-- is commutative
  12.  * 0200-- is right, not left-associative
  13.  * 0400-- is leaf of tree
  14.  * *0XX000-- XX is priority of operator
  15.  */
  16. int opdope[] {
  17.     000000,    /* EOF */
  18.     000000,    /* ; */
  19.     000000,    /* { */
  20.     000000,    /* } */
  21.     036000,    /* [ */
  22.     002000,    /* ] */
  23.     036000,    /* ( */
  24.     002000,    /* ) */
  25.     014201,    /* : */
  26.     007001,    /* , */
  27.     000000,    /* field selection */
  28.     000000,    /* 11 */
  29.     000000,    /* 12 */
  30.     000000,    /* 13 */
  31.     000000,    /* 14 */
  32.     000000,    /* 15 */
  33.     000000,    /* 16 */
  34.     000000,    /* 17 */
  35.     000000,    /* 18 */
  36.     000000,    /* 19 */
  37.     000400,    /* name */
  38.     000400,    /* short constant */
  39.     000400,    /* string */
  40.     000400,    /* float */
  41.     000400,    /* double */
  42.     000000,    /* 25 */
  43.     000000,    /* 26 */
  44.     000000,    /* 27 */
  45.     000000,    /* 28 */
  46.     000000, /* 29 */
  47.     034203,    /* ++pre */
  48.     034203,    /* --pre */
  49.     034203,    /* ++post */
  50.     034203,    /* --post */
  51.     034220,    /* !un */
  52.     034202,    /* &un */
  53.     034220,    /* *un */
  54.     034200,    /* -un */
  55.     034220,    /* ~un */
  56.     036001,    /* . (structure reference) */
  57.     030101,    /* + */
  58.     030001,    /* - */
  59.     032101,    /* * */
  60.     032001,    /* / */
  61.     032001,    /* % */
  62.     026061,    /* >> */
  63.     026061,    /* << */
  64.     020161,    /* & */
  65.     017161,    /* | */
  66.     017161,    /* ^ */
  67.     036001,    /* -> */
  68.     000000, /* int -> double */
  69.     000000, /* double -> int */
  70.     016001, /* && */
  71.     015001, /* || */
  72.     030001, /* &~ */
  73.     000000, /* 56 */
  74.     000000, /* 57 */
  75.     000000, /* 58 */
  76.     000000,    /* 59 */
  77.     022005,    /* == */
  78.     022005,    /* != */
  79.     024005,    /* <= */
  80.     024005,    /* < */
  81.     024005,    /* >= */
  82.     024005,    /* > */
  83.     024005,    /* <p */
  84.     024005,    /* <=p */
  85.     024005,    /* >p */
  86.     024005,    /* >=p */
  87.     012213,    /* =+ */
  88.     012213,    /* =- */
  89.     012213,    /* =* */
  90.     012213,    /* =/ */
  91.     012213,    /* =% */
  92.     012253,    /* =>> */
  93.     012253,    /* =<< */
  94.     012253,    /* =& */
  95.     012253,    /* =| */
  96.     012253,    /* =^ */
  97.     012213,    /* = */
  98.     000000,    /* 81 */
  99.     000000,    /* 82 */
  100.     000000,    /* 83 */
  101.     000000,    /* 84 */
  102.     000000,    /* 85 */
  103.     000000,    /* 86 */
  104.     000000,    /* 87 */
  105.     000000,    /* 88 */
  106.     000000,    /* 89 */
  107.     014201,    /* ? */
  108.     034200,    /* sizeof */
  109.     000000,    /* 92 */
  110.     000000,    /* 93 */
  111.     000000,    /* 94 */
  112.     000000,    /* 95 */
  113.     000000,    /* 96 */
  114.     000000,    /* 97 */
  115.     000000,    /* 98 */
  116.     000000,    /* 99 */
  117.     036001,    /* call */
  118.     036001,    /* mcall */
  119.     000000,    /* goto */
  120.     000000,    /* jump cond */
  121.     000000,    /* branch cond */
  122.     000000,    /* 105 */
  123.     000000, /* 106 */
  124.     000000,    /* 107 */
  125.     000000,    /* 108 */
  126.     000000,    /* 109 */
  127.     000000    /* force r0 */
  128. };
  129.  
  130. /*
  131.  * conversion table:
  132.  * FTI: float (or double) to integer
  133.  * ITF: integer to float
  134.  * ITP: integer to pointer
  135.  * ITL: integer to long
  136.  * LTI: long to integer
  137.  * LTF: long to float
  138.  * FTL: float to long
  139.  * PTI: pointer to integer
  140.  * XX: usually illegal
  141.  * When FTI, LTI, FTL are added in they specify
  142.  * that it is the left operand that should be converted.
  143.  * For + this is done and the conversion is turned back into
  144.  * ITF, ITL, LTF.
  145.  * For = however the left operand can't be converted
  146.  * and the specified conversion is applied to the rhs.
  147.  */
  148. char cvtab[4][4] {
  149. /*        int    double        long        ptr */
  150. /* int */    0,    (FTI<<4)+ITF,    (LTI<<4)+ITL,    (ITP<<4)+ITP,    
  151. /* double */    ITF,    0,        LTF,        XX,
  152. /* long */    ITL,    (FTL<<4)+LTF,    0,        XX,
  153. /* ptr */    ITP,    XX,        XX,        PTI
  154. };
  155.  
  156. /*
  157.  * character type table
  158.  */
  159. char ctab[] {
  160.     EOF,    INSERT,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,
  161.     UNKN,    SPACE,    NEWLN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,
  162.     UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,
  163.     UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,    UNKN,
  164.     SPACE,    EXCLA,    DQUOTE,    UNKN,    UNKN,    MOD,     AND,    SQUOTE,
  165.     LPARN,    RPARN,    TIMES,    PLUS,    COMMA,    MINUS,    PERIOD,    DIVIDE,
  166.     DIGIT,    DIGIT,    DIGIT,    DIGIT,    DIGIT,    DIGIT,    DIGIT,    DIGIT,
  167.     DIGIT,    DIGIT,    COLON,    SEMI,    LESS,    ASSIGN,    GREAT,    QUEST,
  168.     UNKN,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,
  169.     LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,
  170.     LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,
  171.     LETTER,    LETTER,    LETTER,    LBRACK,    UNKN,    RBRACK,    EXOR,    LETTER,
  172.     UNKN,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,
  173.     LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,
  174.     LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,    LETTER,
  175.     LETTER,    LETTER,    LETTER,    LBRACE,    OR,    RBRACE,    COMPL,    UNKN
  176. };
  177.