# #include #include extern int _lmovb(); #line 8 "WORD.LXI" char line[133]; char *linep = &line; int is_eof = 0; int wordct = 0; #define T_EOL 1 main() { register int i; while ((i = yylex()) != 0) { /* * If the "end-of-line" token is returned * AND we're really at the end of a line, * read the next line. Note that T_EOL is * returned twice when the program starts * because of the nature of the look-ahead * algorithms. */ if (i == T_EOL && !is_eof && *linep == 0) { printf("* "); fflush(stdout); getline(); } } printf("%d words\n", wordct); } _Alextab(__na__) { switch (__na__) { case 0: #line 37 "WORD.LXI" /* * Write each word on a seperate line */ lexecho(stdout); printf("\n"); wordct++; return(LEXSKIP); break; case 1: #line 46 "WORD.LXI" return(T_EOL); break; case 2: #line 49 "WORD.LXI" return(LEXSKIP); break; } return(LEXSKIP); } #line 52 "WORD.LXI" getline() /* * Read a line for lexgetc() */ { is_eof = (fgets(line, sizeof line, stdin) == NULL); linep = &line; } lexgetc() /* * Homemade lexgetc -- return zero while at the end of an * input line or EOF at end of file. If more on this line, * return it. */ { return((is_eof) ? EOF : (*linep == 0) ? 0 : *linep++); } int _Flextab[] { -1, 2, 2, 1, 0, 0, -1, }; #line 72 "WORD.LXI" #define LLTYPE1 char LLTYPE1 _Nlextab[] { 3, 6, 6, 6, 6, 6, 6, 6, 6, 1, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 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, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }; LLTYPE1 _Dlextab[] { 6, 6, 1, 6, 6, 4, }; int _Blextab[] { 0, 118, 0, 0, 118, 0, 0, }; #define LLILL LLILL char _Zlextab[] { 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, 0377, }; struct lextab lextab { 6, /* last state */ _Dlextab, /* defaults */ _Nlextab, /* next */ _Clextab, /* check */ _Blextab, /* base */ 244, /* last in base */ _lmovb, /* byte-int move routines */ _Flextab, /* final state descriptions */ _Alextab, /* action routine */ NULL, /* look-ahead vector */ 0, /* no ignore class */ 0, /* no break class */ _Zlextab, /* illegal class */ };