Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2774

Converting a lex scanner to flex, help needed

Path csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From arnold@skeeve.com (Aharon Robbins)
Newsgroups comp.compilers
Subject Converting a lex scanner to flex, help needed
Date Wed, 29 Dec 2021 20:54:01 -0000 (UTC)
Organization Aioe.org NNTP Server
Lines 32
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <21-12-019@comp.compilers> (permalink)
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="89764"; mail-complaints-to="abuse@iecc.com"
Keywords lex, question, comment
Posted-Date 29 Dec 2021 17:36:46 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Originator arnold@skeeve.com (Arnold Robbins)
Xref csiph.com comp.compilers:2774

Show key headers only | View raw


Hi.

I am trying to convert a V7 Unix vintage lex scanner to flex.

The rule

	#.*	{fixval(); xxbp = -1; return(xxcom); }

seems to be consuming as much as it can instead of stopping at
the first newline.  When I look at the collected buffer, it
has multiple lines in it:

(gdb) p xxbuf
$7 = "#  ========== ratfor in fortran for bootstrap ==========\n#\n# block data - initialize global variables\n#\nblock data\ncommon /cchar/ extdig(10), intdig(10), extlet(26), intlet(26),  extbig(26), intbig(26"...

The program I am trying to modernize is 'struct', which reads Fortran and
produces Ratfor.  The lex scanner is in the 'beautify' part. The whole
thing is at https://github.com/arnoldrobbins/struct. If you clone the
repo, check out the 'modernize' branch, and fix the makefile to compile
with gcc -m32, you will get working binaries.  (64 bit and cleaning up
the warnings is work in progress.)

What am I doing wrong?

Thanks,

Arnold
--
Aharon (Arnold) Robbins 		arnold AT skeeve DOT com
[In flex a . doesn't match a newline.  What do you see when you look at yytext, which
is the token it matched?  The input buffer doesn't tell you anything very useful about
individual matched tokens. -John]

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

Converting a lex scanner to flex, help needed arnold@skeeve.com (Aharon Robbins) - 2021-12-29 20:54 +0000
  Re: Converting a lex scanner to flex, help needed arnold@skeeve.com (Aharon Robbins) - 2021-12-30 08:10 +0000

csiph-web