summaryrefslogtreecommitdiffstats
path: root/Parser/pgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/pgen.c')
-rw-r--r--Parser/pgen.c97
1 files changed, 23 insertions, 74 deletions
diff --git a/Parser/pgen.c b/Parser/pgen.c
index dbaadbd..0bc38dc 100644
--- a/Parser/pgen.c
+++ b/Parser/pgen.c
@@ -55,8 +55,7 @@ static void compile_atom(labellist *ll,
nfa *nf, node *n, int *pa, int *pb);
static int
-addnfastate(nf)
- nfa *nf;
+addnfastate(nfa *nf)
{
nfastate *st;
@@ -70,9 +69,7 @@ addnfastate(nf)
}
static void
-addnfaarc(nf, from, to, lbl)
- nfa *nf;
- int from, to, lbl;
+addnfaarc(nfa *nf, int from, int to, int lbl)
{
nfastate *st;
nfaarc *ar;
@@ -87,8 +84,7 @@ addnfaarc(nf, from, to, lbl)
}
static nfa *
-newnfa(name)
- char *name;
+newnfa(char *name)
{
nfa *nf;
static int type = NT_OFFSET; /* All types will be disjunct */
@@ -114,7 +110,7 @@ typedef struct _nfagrammar {
static void compile_rule(nfagrammar *gr, node *n);
static nfagrammar *
-newnfagrammar()
+newnfagrammar(void)
{
nfagrammar *gr;
@@ -130,9 +126,7 @@ newnfagrammar()
}
static nfa *
-addnfa(gr, name)
- nfagrammar *gr;
- char *name;
+addnfa(nfagrammar *gr, char *name)
{
nfa *nf;
@@ -160,8 +154,7 @@ static char REQNFMT[] = "metacompile: less than %d children\n";
#endif
static nfagrammar *
-metacompile(n)
- node *n;
+metacompile(node *n)
{
nfagrammar *gr;
int i;
@@ -179,9 +172,7 @@ metacompile(n)
}
static void
-compile_rule(gr, n)
- nfagrammar *gr;
- node *n;
+compile_rule(nfagrammar *gr, node *n)
{
nfa *nf;
@@ -200,11 +191,7 @@ compile_rule(gr, n)
}
static void
-compile_rhs(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_rhs(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
int a, b;
@@ -237,11 +224,7 @@ compile_rhs(ll, nf, n, pa, pb)
}
static void
-compile_alt(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_alt(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
int a, b;
@@ -268,11 +251,7 @@ compile_alt(ll, nf, n, pa, pb)
}
static void
-compile_item(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_item(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
int a, b;
@@ -309,11 +288,7 @@ compile_item(ll, nf, n, pa, pb)
}
static void
-compile_atom(ll, nf, n, pa, pb)
- labellist *ll;
- nfa *nf;
- node *n;
- int *pa, *pb;
+compile_atom(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
{
int i;
@@ -339,10 +314,7 @@ compile_atom(ll, nf, n, pa, pb)
}
static void
-dumpstate(ll, nf, istate)
- labellist *ll;
- nfa *nf;
- int istate;
+dumpstate(labellist *ll, nfa *nf, int istate)
{
nfastate *st;
int i;
@@ -365,9 +337,7 @@ dumpstate(ll, nf, istate)
}
static void
-dumpnfa(ll, nf)
- labellist *ll;
- nfa *nf;
+dumpnfa(labellist *ll, nfa *nf)
{
int i;
@@ -381,10 +351,7 @@ dumpnfa(ll, nf)
/* PART TWO -- CONSTRUCT DFA -- Algorithm 3.1 from [Aho&Ullman 77] */
static void
-addclosure(ss, nf, istate)
- bitset ss;
- nfa *nf;
- int istate;
+addclosure(bitset ss, nfa *nf, int istate)
{
if (addbit(ss, istate)) {
nfastate *st = &nf->nf_state[istate];
@@ -426,10 +393,7 @@ static void simplify(int xx_nstates, ss_state *xx_state);
static void convert(dfa *d, int xx_nstates, ss_state *xx_state);
static void
-makedfa(gr, nf, d)
- nfagrammar *gr;
- nfa *nf;
- dfa *d;
+makedfa(nfagrammar *gr, nfa *nf, dfa *d)
{
int nbits = nf->nf_nstates;
bitset ss;
@@ -533,12 +497,8 @@ makedfa(gr, nf, d)
}
static void
-printssdfa(xx_nstates, xx_state, nbits, ll, msg)
- int xx_nstates;
- ss_state *xx_state;
- int nbits;
- labellist *ll;
- char *msg;
+printssdfa(int xx_nstates, ss_state *xx_state, int nbits,
+ labellist *ll, char *msg)
{
int i, ibit, iarc;
ss_state *yy;
@@ -579,8 +539,7 @@ printssdfa(xx_nstates, xx_state, nbits, ll, msg)
*/
static int
-samestate(s1, s2)
- ss_state *s1, *s2;
+samestate(ss_state *s1, ss_state *s2)
{
int i;
@@ -595,10 +554,7 @@ samestate(s1, s2)
}
static void
-renamestates(xx_nstates, xx_state, from, to)
- int xx_nstates;
- ss_state *xx_state;
- int from, to;
+renamestates(int xx_nstates, ss_state *xx_state, int from, int to)
{
int i, j;
@@ -615,9 +571,7 @@ renamestates(xx_nstates, xx_state, from, to)
}
static void
-simplify(xx_nstates, xx_state)
- int xx_nstates;
- ss_state *xx_state;
+simplify(int xx_nstates, ss_state *xx_state)
{
int changes;
int i, j;
@@ -648,10 +602,7 @@ simplify(xx_nstates, xx_state)
/* Convert the DFA into a grammar that can be used by our parser */
static void
-convert(d, xx_nstates, xx_state)
- dfa *d;
- int xx_nstates;
- ss_state *xx_state;
+convert(dfa *d, int xx_nstates, ss_state *xx_state)
{
int i, j;
ss_state *yy;
@@ -685,8 +636,7 @@ convert(d, xx_nstates, xx_state)
/* PART FIVE -- GLUE IT ALL TOGETHER */
static grammar *
-maketables(gr)
- nfagrammar *gr;
+maketables(nfagrammar *gr)
{
int i;
nfa *nf;
@@ -714,8 +664,7 @@ maketables(gr)
}
grammar *
-pgen(n)
- node *n;
+pgen(node *n)
{
nfagrammar *gr;
grammar *g;