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


Groups > comp.compilers > #2774

Converting a lex scanner to flex, help needed

From arnold@skeeve.com (Aharon Robbins)
Newsgroups comp.compilers
Subject Converting a lex scanner to flex, help needed
Date 2021-12-29 20:54 +0000
Organization Aioe.org NNTP Server
Message-ID <21-12-019@comp.compilers> (permalink)

Show all headers | 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