allow for multiple parsers within one program

This commit is contained in:
ceriel 1990-01-29 13:51:32 +00:00
parent da48891d6e
commit 8c6dc46124
3 changed files with 12 additions and 22 deletions

View file

@ -125,10 +125,5 @@ Are intended to be self-explanatory. They are reported
on standard error. A more detailed report is found in the on standard error. A more detailed report is found in the
\fILL.output\fP \fILL.output\fP
file. file.
.SH BUGS
Because some file names are fixed, at most one
\fILLgen\fP
process can be active in a given directory at
a time.
.SH AUTHOR .SH AUTHOR
Ceriel J. H. Jacobs Ceriel J. H. Jacobs

View file

@ -1,6 +1,8 @@
/* $Header$ */ /* $Header$ */
#ifdef LL_DEBUG #ifdef LL_DEBUG
#define LL_assert(x) if(!(x)) LL_badassertion("x",__FILE__,__LINE__) #include <assert.h>
#include <stdio.h>
#define LL_assert(x) assert(x)
#else #else
#define LL_assert(x) /* nothing */ #define LL_assert(x) /* nothing */
#endif #endif
@ -15,8 +17,6 @@ extern int LLsymb;
#define LLscan(x) if ((LLsymb = LL_LEXI()) != x) LLerror(x); else #define LLscan(x) if ((LLsymb = LL_LEXI()) != x) LLerror(x); else
#endif #endif
# include "Lpars.h"
extern unsigned int LLscnt[]; extern unsigned int LLscnt[];
extern unsigned int LLtcnt[]; extern unsigned int LLtcnt[];
extern int LLcsymb; extern int LLcsymb;

View file

@ -7,10 +7,6 @@
static char *rcsid = "$Header$"; static char *rcsid = "$Header$";
# endif # endif
# ifdef LL_DEBUG
# include <stdio.h>
# endif
unsigned int LLtcnt[LL_NTERMINALS]; unsigned int LLtcnt[LL_NTERMINALS];
unsigned int LLscnt[LL_NSETS]; unsigned int LLscnt[LL_NSETS];
int LLcsymb, LLsymb; int LLcsymb, LLsymb;
@ -20,7 +16,7 @@ static int LLlevel;
extern LLread(); extern LLread();
extern int LLskip(); extern int LLskip();
extern int LLnext(); extern int LLnext();
#ifndef LLscan #ifndef LL_FASTER
extern LLscan(); extern LLscan();
#endif #endif
extern LLerror(); extern LLerror();
@ -30,7 +26,11 @@ extern int LLfirst();
extern LLnewlevel(); extern LLnewlevel();
extern LLoldlevel(); extern LLoldlevel();
#ifndef LLscan #ifdef LL_USERHOOK
static LLdoskip();
#endif
#ifndef LL_FASTER
LLscan(t) { LLscan(t) {
/* /*
* Check if the next symbol is equal to the parameter * Check if the next symbol is equal to the parameter
@ -123,6 +123,7 @@ LLskip() {
return LLdoskip(0); return LLdoskip(0);
} }
static int
LLuserhook(exp, list) LLuserhook(exp, list)
int *list; int *list;
{ {
@ -132,6 +133,7 @@ LLuserhook(exp, list)
return LLsymb != old; return LLsymb != old;
} }
static
LLmklist(list) LLmklist(list)
register int *list; register int *list;
{ {
@ -157,6 +159,7 @@ LLmklist(list)
*list = 0; *list = 0;
} }
static
LLdoskip(exp) { LLdoskip(exp) {
int LLx; int LLx;
int list[LL_NTERMINALS+1]; int list[LL_NTERMINALS+1];
@ -240,11 +243,3 @@ LLoldlevel(LLsinfo) unsigned int *LLsinfo; {
LLcsymb = (int) LLsinfo[LL_NSETS+LL_NTERMINALS+1]; LLcsymb = (int) LLsinfo[LL_NSETS+LL_NTERMINALS+1];
} }
} }
# ifdef LL_DEBUG
LL_badassertion(asstr,file,line) char *asstr, *file; {
fprintf(stderr,"Assertion \"%s\" failed %s(%d)\n",asstr,file,line);
abort();
}
# endif