State Machines (was Re: gotos)

kenny at uiucdcsm.cs.uiuc.edu kenny at uiucdcsm.cs.uiuc.edu
Wed May 18 02:32:00 AEST 1988


/* Written  3:04 am  May 16, 1988 by mouse at mcgill-vision.UUCP in uiucdcsm:comp.lang.c */
In article <1945 at sugar.UUCP>, peter at sugar.UUCP (Peter da Silva) writes:
> I submit that there is one case where gotos are no worse and possibly
> better than the alternative.  And that is state machine type code, as
> is found in lexers.

Ideally, one should use a real lexer language.
[...]
/* End of text from uiucdcsm:comp.lang.c */

     Moreover, with the release of flex to the public, one doesn't
need to be on a Un*x system to use a real lexer language; I've already
heard from a gentleman who's got flex up and running on an IBM PC.

     The advent of Bison does the same for LR parser languages, or
would were it not for the fact that whenever you use Bison, it puts
the FSF copyright on your code.  There are a couple of clients that I
can't use Bison with, because of pre-existing agreements *not* to
release the work I do for them.

Kevin



More information about the Comp.lang.c mailing list