home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2-YACC.ZIP / PREP.H < prev    next >
C/C++ Source or Header  |  1980-01-04  |  3KB  |  123 lines

  1. /*
  2.   HEADER: CUG     nnn.nn;
  3.   TITLE:     PREP - Preprocessor for YACC
  4.   VERSION:     1.0 for IBM-PC
  5.   DATE:      JAN 28, 1985
  6.   DESCRIPTION:     Preprocessor for YACC Programs
  7.   KEYWORDS:     Preprocessor IBM YACC LEX UNIX
  8.   SYSTEM:     IBM-PC and Compatiables
  9.   FILENAME:      PREP.H
  10.   WARNINGS:     This program is not for the casual user. It will
  11.          be useful primarily to expert developers.
  12.   CRC:         N/A
  13.   SEE-ALSO:     LEX and YACC
  14.   AUTHORS:     Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:     UNIX Systems Manuals
  17. */
  18.  
  19. /*
  20.  *      common structures, definitions and so on
  21.  */
  22.  
  23. /*
  24.  *
  25.  *      J van Katwijk
  26.  *      Delft University of Technology,
  27.  *      Department of Mathematics,
  28.  *      132 Julianalaan
  29.  *      Delft, The Netherlands
  30.  *
  31.  *      See for a functional description:
  32.  *
  33.  *      SIGPLAN NOTICES
  34.  *      October 1983, 18 (10) pp 12 .. 16
  35.  */
  36. #define MAXATTR 10
  37. #define PAR_SIZ 26
  38. #define TAGSIZE 3000
  39. #define MAXDEF  20              /* I donot know */
  40. #define NONTERM 200             /* include .../dextern?? */
  41. #define WSTACKSIZE      40      /* arbitrary choice     */
  42. #define OUTSTACKSIZE    20      /* idem                 */
  43.  
  44. #define NAMESIZE        25      /* idem                 */
  45.  
  46. #define FATAL   030
  47. #define WARNING 040
  48.  
  49. #define AS_LOCAL        010
  50. #define AS_STACK        020
  51. #define LOC_STRING      "_L%dL_"
  52.  
  53. struct type_elem {
  54.         int un_number;          /* union field number */
  55.         char *type_name;        /* type to be united  */
  56. };
  57.  
  58. struct param {
  59.         int par_no;
  60.         int direction;  /* INPUT or OUTPUT */
  61.         struct type_elem *par_desc;
  62. };
  63.  
  64. struct att_def {
  65.         int i_par, o_par;
  66.         struct param attributes [MAXATTR];
  67.         char *nonterm;
  68.         char hasdefinition;
  69. };
  70.  
  71. struct stack_elem {
  72.         char par_name [PAR_SIZ];        /* keep it simple */
  73.         struct type_elem *par_def;
  74.         struct {
  75.                 char how_to_access;
  76.                 int ac_offset;
  77.                 int ac_lab;
  78.         } access;               /* for access function */
  79.  
  80. };
  81.  
  82. /*
  83.  *      some token definitions
  84.  */
  85. #define ENDFILE 0
  86. #define COLON   1
  87. #define SEMI    2
  88. #define BAR     3
  89. #define INPUT   3       /* oh yes !!! */
  90. #define EQ_SYMB 4
  91. #define IDENT   5
  92. #define TERM    6
  93. #define LEFT    7
  94. #define BINARY  8
  95. #define RIGHT   9
  96. #define MARK    10
  97. #define PREC    11
  98. #define LCURL   12
  99. #define START   13
  100. #define TYPE    14
  101. #define UNION   15
  102. #define ATTR_DEF        16
  103. #define COMMA   17
  104. #define LPAR    18
  105. #define RPAR    19
  106. #define OUTPUT  20
  107. #define NUMBER  21
  108.  
  109. #ifndef prep4
  110. extern  FILE    finput, foutput;
  111. extern  int     lineno;
  112. extern  int     tok;
  113. extern  char    tokname[];
  114. extern  char    *infile;
  115. extern          error ();
  116. #endif
  117.  
  118. extern  struct att_def *lookup ();
  119.  
  120. #define islower(x)      ('a' <= x && x <= 'z')
  121. #define isupper(x)      ('A' <= x && x <= 'Z')
  122. #define isdigit(x)      ('0' <= x && x <= '9')
  123.