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