🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #1835

How to work with FLEX (Was: Re: flex follies)

#1835
From: Michael Vishchers
Date: Fri, 16 Jun 1989 09:29
54 lines
2654 bytes
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\
________________________________________________________________________
 
Technical Details
Message-ID: <1422@laura.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!csd4.milw.wisc.edu!leah!albanycs!crdgw1!uunet!mcvax!unido!laura!exunido!agrusow

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mailrus!csd4.milw.wisc.edu!leah!albanycs!crdgw1!uunet!mcvax!unido!laura!exunido!agrusow
From: agrusow@exunido.uucp (Michael Vishchers)
Newsgroups: comp.sys.atari.st
Subject: How to work with FLEX (Was: Re: flex follies)
Summary: Flex works with Sozobon.. if you know how
Message-ID: <1422@laura.UUCP>
Date: 16 Jun 89 09:29:15 GMT
Sender: news@laura.UUCP
Reply-To: agrusow@exunido.UUCP (Michael Vishchers)
Organization: University of Dortmund, W-Germany
Lines: 54