[comp.sys.atari.st] How to work with FLEX

agrusow@exunido.uucp (Michael Vishchers) (06/16/89)

For all of you who got my FLEX port from comp.binaries.atari.st and have been
discouraged by the article of Michal Jaegermann (or own experience) :

       Don't throw FLEX away !! It works (at least with Sozobon C)

There seems to be a small bug, but I'll give you an easy solution:

As described in "Compilers: Principles, Techniques and Tools" 
by Aho, Sethi, Ullman (the famous dragonbook), p. 107,
"a lex program consists of three parts:

        declarations
        %%
        translation rules
        %%                                             <= NOTE THIS LINE !!	
        auxiliary procedures
"

It is true that most lex's accept the form 

        declarations
        %%
        translation rules	,

but flex gets confused if he doesn't see the second "%%" line, and the
generated code is not ordered properly.

I admit this IS a bug, but you can circumvent it easily if you append
the second "%%" line after the translation rules, i.e., a minimal flex input
should contain two "%%" lines. I may fix this bug someday, I think.

There is another bug in the Sozobon C Compiler (Hi Tony, are you listening ?)
Consider the following "program":

        main () { case 1: return 0 ; }

Instead of giving an error message like "case without switch", it just bombs.
And exactly this is what happened to M. Jaegermann.

I am sorry for the inconvenience, but at least I know that someone tried to
use the program  8-) .

If you find other bugs, please let me know.

Michael
 ______________________________________________________________________
/ Michael Vishchers                           | History repeats itself.\
| michaelV@owl.ls5.informatik.uni-dortmund.de | Has to.                |
| michaelV%owl.ls5@UNIDO.uucp                 | No one listens.        |
| (I think)                                   |        (steve turner)  |
\______________________________________________________________________/
/ Home address:: Frohnhauser Str. 233    D-4300 Essen 1    West-Germany\
________________________________________________________________________