[plt-scheme] Shriram Krishnamurthi's "automaton" macro from "Swine before Perl"
Hi Chris --
I don't think I would go about doing it the way you're doing it. The
point is to make the automaton language as descriptive as possible.
Right now, the semantics of the automaton language are that it will
accept any prefix of the full string as well as the full string. In
that sense, every state is an accepting state. If you want to change
that, then you have to designate specific states as accepting, and the
others are implicitly not accepting.
Therefore, I would do the following:
1. Add a tag to a state designating it as accepting (or non-accepting).
2. If a state is accepting, allow the stream to be empty.
3. If a state is non-accepting, and the stream is empty, signal
failure to accept the string.
Btw, this is not easy to do in SYNTAX-RULES (ie, I don't know of a way
of doing it with just a few keystrokes).
Shriram