Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2806
| From | gah4 <gah4@u.washington.edu> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Looking for Unix lex for modern systems |
| Date | 2022-01-07 15:36 -0800 |
| Organization | Compilers Central |
| Message-ID | <22-01-030@comp.compilers> (permalink) |
| References | <22-01-023@comp.compilers> <22-01-024@comp.compilers> |
(snip, our moderator wrote) > [Flex can take the same input as lex but its internals are totally different. > > Bell Labs long ago released the code to early Unix systems. The source > for lex is here: > https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/lex or on > the 4.2BSD src archive at > https://www.tuhs.org/Archive/Distributions/UCB/4.2BSD/ > I tried to compile the 4.2BSD version on FreeBSD and the errors were > ugly. -John] It seems that real lex known about RATFOR, and I suspect that actual flex doesn't. Is that a good test for which source you have? In any case, with gcc -std=c89 -Dunix there aren't so many errors (that aren't warnings). The warnings are from conversion of either the wrong pointer type, or between integer and pointer. I am not so sure how well current systems do the latter. (That seems to be usual for C from those years.) Fixing the actual errors, including removing the initialization of *errorf with stdout, and not declaring calloc, it compiles and (with the -t option) runs. It then stops with: (Error) output table overflow 5/1000 nodes(%e), 10/2500 positions(%p), 3/500 (%n), 254 transitions , 2/1000 packed char classes(%k), 3/2000 packed transitions(%a), 0/0 output slots(%o) (I have the sample file from the Wikipedia page for input.) Reminds me, in the days of OS/2 1.0, I was compiling the GNU utilities, and especially grep and diff, for OS/2. In many cases, they would mix integer and (char*), especially in function arguments. Replacing 0 with (char*)0 fixed those, but I also complained to the GNU people. The reply was that, pretty much, any system with sizeof(int) not equal to sizeof(char*) was broken, and it wasn't their problem to fix. [If the comments in the source code say "written by Eric Schmidt", it's lex, otherwise, it's flex. Yes, that Eric Schmidt. -John]
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Looking for Unix lex for modern systems arnold@skeeve.com (Aharon Robbins) - 2022-01-06 20:17 +0000
Re: Looking for Unix lex for modern systems gah4 <gah4@u.washington.edu> - 2022-01-06 16:42 -0800
Re: Looking for Unix lex for modern systems gah4 <gah4@u.washington.edu> - 2022-01-07 15:36 -0800
Re: Looking for Unix lex for modern systems gah4 <gah4@u.washington.edu> - 2022-01-07 02:39 -0800
Re: Looking for Unix lex for modern systems arnold@skeeve.com (Aharon Robbins) - 2022-01-09 19:04 +0000
Re: Looking for Unix lex for modern systems gah4 <gah4@u.washington.edu> - 2022-01-09 17:03 -0800
Re: Looking for Unix lex for modern systems gah4 <gah4@u.washington.edu> - 2022-01-12 14:45 -0800
csiph-web