/* dfa0.c - Don Yang (uguu.org) 06/16/01 */ #include #include static char *dfa[] = { "/1 '|4 \"|6 .|0", "*{{2 /}1 .}|0", "*{3 .{2", "*{3 /{0 .{2", "'|0 \\|5 .|4", ".|4", "\"|0 \\|7 .|6", ".|6"}; static int state = 0; static int input; static char *cursor; int main(void) { while( (input = getchar()) > 0 ) { for(cursor = dfa[state]; *cursor; cursor++) { if( *cursor != ' ' ) { if( *cursor == '.' || (int)(*cursor) == input ) break; for(; !isdigit(*cursor); cursor++); } } for(; !isdigit(*cursor); cursor++) { if( *cursor > 'z' ) putchar( *cursor == '|' ? input : *cursor < '|' ? input < ' ' ? input : ' ' : '/'); } state = *cursor - '0'; } return 0; }