home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2-YACC.ZIP / Y2IMP.C < prev    next >
C/C++ Source or Header  |  1989-09-29  |  2KB  |  73 lines

  1. /*
  2.   HEADER: CUG     nnn.nn;
  3.   TITLE:     YACC - Yet Another Compilier-Compilier
  4.   VERSION:     1.0 for IBM-PC
  5.   DATE:      JAN 28, 1985
  6.   DESCRIPTION:     LALR(1) Parser Generator. From UNIX
  7.   KEYWORDS:     Parser Generator Compilier-Compilier YACC
  8.   SYSTEM:     IBM-PC and Compatiables
  9.   FILENAME:      Y2IMP.C
  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 PREP
  14.   AUTHORS:     Scott Guthery 11100 leafwood lane Austin, TX 78750
  15.   COMPILERS:     DESMET-C
  16.   REFERENCES:     UNIX Systems Manuals
  17. */
  18.  
  19. /* Impure data needed by routines pulled from Y2.C */
  20.  
  21. #define y2imp YES
  22. #include "dtxtrn.h"
  23.  
  24. /* communication variables between various I/O routines */
  25.  
  26. char *infile;   /* input file name */
  27. int numbval;    /* value of an input number */
  28. char tokname[NAMESIZE]; /* input token name */
  29.  
  30. /* storage of names */
  31.  
  32. char cnames[CNAMSZ];    /* place where token and nonterminal names are stored */
  33. int cnamsz = CNAMSZ;    /* size of cnames */
  34. char * cnamp = cnames;  /* place where next name is to be put in */
  35. int ndefout = 3;  /* number of defined symbols output */
  36.  
  37. /* storage of types */
  38. int ntypes;     /* number of types defined */
  39. char * typeset[NTYPES]; /* pointers to type tags */
  40.  
  41. /* symbol tables for tokens and nonterminals */
  42.  
  43. int ntokens = 0;
  44. struct toksymb tokset[NTERMS];
  45. int toklev[NTERMS];
  46. int nnonter = -1;
  47. struct ntsymb nontrst[NNONTERM];
  48. int start;      /* start symbol */
  49.  
  50. /* assigned token type values */
  51. int extval = 0;
  52.  
  53. /* input and output file descriptors */
  54.  
  55. FILE * finput;          /* yacc input file */
  56. FILE * faction;         /* file for saving actions */
  57. FILE * fdefine;         /* file for # defines */
  58. FILE * ftable;          /* y.tab.c file */
  59. FILE * ftemp;           /* tempfile to pass 2 */
  60. FILE * foutput;         /* y.output file */
  61.  
  62. /* storage for grammar rules */
  63.  
  64. int mem0[MEMSIZE] ; /* production storage */
  65. int *mem = mem0;
  66. int nprod= 1;   /* number of productions */
  67. int *prdptr[NPROD];     /* pointers to descriptions of productions */
  68. int levprd[NPROD] ;     /* precedence levels for the productions */
  69.  
  70. /* Statics pulled from modules */
  71.  
  72. int peekline;           /* from gettok() */
  73.