33 |
#include "alist.h" |
#include "alist.h" |
34 |
#include "automaton.h" |
#include "automaton.h" |
35 |
|
|
36 |
#ifdef DEBUG_AUTOMATON__ |
#ifdef DEBUG_AUTOMATON |
37 |
#define DMSG(a) a |
#define DMSG(a) a |
38 |
#else |
#else |
39 |
#define DMSG(a) |
#define DMSG(a) |
170 |
{ |
{ |
171 |
int i,l; |
int i,l; |
172 |
FILE* f; |
FILE* f; |
173 |
|
#ifdef HAVE_SYS_WAIT_H |
174 |
pid_t pid; |
pid_t pid; |
175 |
|
#endif |
176 |
|
|
177 |
if (a == NULL) |
if (a == NULL) |
178 |
return ; |
return ; |
179 |
f=fopen(filename,"w"); |
f=fopen(filename,"w"); |
414 |
alist_insert(Ry,z->id); /* Ry = Ry \cup succ(z) */ |
alist_insert(Ry,z->id); /* Ry = Ry \cup succ(z) */ |
415 |
} |
} |
416 |
|
|
417 |
#if 0 |
/* \epsilon transition from start node */ |
418 |
if ((z = y->next[RE_EPSILON]) != NULL) /* \delta (y,z) = \epsilon */ |
if ((z = y->next[RE_EPSILON]) != NULL) /* \delta (y,z) = \epsilon */ |
419 |
{ |
{ |
420 |
r = s_automaton_successor(z->id,letter,nfa, list); |
r = s_automaton_successor(z->id,letter,nfa, list); |
421 |
alist_insert(Ry,r); /* Ry = Ry \cup succ(z) */ |
alist_insert(Ry,r); /* Ry = Ry \cup succ(z) */ |
422 |
alist_delete(r); |
alist_delete(r); |
423 |
} |
} |
|
#endif |
|
424 |
|
|
425 |
if (letter < RE_FINAL_TOK) |
if (letter < RE_FINAL_TOK) |
426 |
{ |
{ |
442 |
} |
} |
443 |
} |
} |
444 |
|
|
445 |
// if (alist_is_empty(Ry)) /* Ry = \empty */ |
#if 0 |
446 |
// return Ry; |
if (alist_is_empty(Ry)) /* Ry = \empty */ |
447 |
|
return Ry; |
448 |
|
#endif |
449 |
|
|
450 |
alist_insert(R,Ry); /* R = R \cup Ry */ |
alist_insert(R,Ry); /* R = R \cup Ry */ |
451 |
alist_delete(Ry); |
alist_delete(Ry); |
655 |
s_automaton_dump(Automaton a, char* filename) |
s_automaton_dump(Automaton a, char* filename) |
656 |
{ |
{ |
657 |
FILE* f; |
FILE* f; |
658 |
|
#ifdef HAVE_SYS_WAIT_H |
659 |
pid_t pid; |
pid_t pid; |
660 |
|
#endif |
661 |
if (a == NULL) |
if (a == NULL) |
662 |
return; |
return; |
663 |
f=fopen(filename,"w"); |
f=fopen(filename,"w"); |