home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
- #define DEBUG 1
-
- #ifdef DEBUG
- #define TRACE report()
- #else
- #define TRACE
- #endif
-
- #include "fsm.h"
-
- extern struct trans s_table[][MAX_ALPH];
-
- extern int state;
- extern int token;
-
- void main(int argc, char **argv)
-
- {
-
- init_fsm(argc,argv);
-
- state = START;
- token = EMPTY;
-
- while (state != END){
- TRACE;
- token = next_token();
- (*s_table[state][token].act)();
- state = s_table[state][token].nextstate;
- }
-
- fini_fsm(argc,argv);
-
- }
-