Parser outputs some stats and fixed error is pseudo.r

This commit is contained in:
bruce 1987-07-28 11:22:59 +00:00
parent ac20a570cd
commit 9e55f02c3b
4 changed files with 15 additions and 13 deletions

View file

@ -110,7 +110,7 @@ increase_next(size)
do {
newsize *= 2;
} while (newsize<size);
printf("Extending next/check arrays from %d to %d\n",currsize,newsize);
printf("Note: Extending next/check arrays from %d to %d\n",currsize,newsize);
next = (int *)Realloc(next,newsize);
check = (int *)Realloc(check,newsize);
/* clear ends of new arrays */
@ -191,9 +191,13 @@ outdfa()
else
base[s] = EMPTY;
}
/* give some statistics on size of dfa */
printf("Number of patterns: %d\n", numpatterns);
printf("Longest pattern: %d\n", maxpattern);
printf("Longest replacement: %d\n", maxreplacement);
printf("Dfa contains %d distinct state/opcode pairs\n", numentries);
printf("Compacted using row displacement into %d entries\n",maxpos);
/* output the arrays */
printf("Compacted %d entries into %d positions\n",numentries,maxpos);
fprintf(ofile,"struct dfa OO_checknext[] = {\n");
for(i=0;i<=maxpos;i++) {
fprintf(ofile,"\t/* %4d */\t",i);

View file

@ -23,6 +23,7 @@ static char rcsidp1[] = "$Header$";
struct state *states[MAXSTATES];
struct action *actions[MAXSTATES];
struct mnems patterns[MAXSTATES];
int numpatterns = 0; /* Number of patterns */
int higheststate = 0; /* Highest state yet allocated */
struct idf *ops; /* Chained list of all ops */
int maxpattern = 0;
@ -59,6 +60,7 @@ optimization
':'
action(&repllist)
{
numpatterns++;
addaction(startline,currentstate,restrictions,
finaltest,repllist);
}

View file

@ -75,6 +75,7 @@ struct state {
extern struct state *states[MAXSTATES];
extern struct action *actions[MAXSTATES];
extern struct mnems patterns[MAXSTATES];
extern int numpatterns; /* Number of patterns */
extern int higheststate; /* Highest state yet allocated */
extern struct idf *ops; /* Chained list of all ops */
extern int maxpattern;

View file

@ -1,22 +1,17 @@
df_dlb | label:l |
register p_instr p = GETNXTPATT();
FLUSHDFA(p);
FLUSHDFA();
C_df_dlb(l);
df_dnam | char *:s |
register p_instr p = GETNXTPATT();
FLUSHDFA(p);
FLUSHDFA();
C_df_dnam(s);
pro | char *:s arith:l |
register p_instr p = GETNXTPATT();
FLUSHDFA(p);
FLUSHDFA();
C_pro(s,l);
pro_narg | char *:s |
register p_instr p = GETNXTPATT();
FLUSHDFA(p);
FLUSHDFA();
C_pro_narg(s);
end | arith:l |
register p_instr p = GETNXTPATT();
FLUSHDFA(p);
FLUSHDFA();
C_end(l);
end_narg | |
FLUSHDFA();