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


Groups > comp.compilers > #2777

Re: Converting a lex scanner to flex, help needed

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

Show all headers | View raw


In article <21-12-019@comp.compilers>,
Aharon Robbins <arnold@skeeve.com> wrote:
>I am trying to convert a V7 Unix vintage lex scanner to flex.
> ....
>[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]

You're right, it looks like yytext is fine.  There seems to be
other stuff going on between the grammar and the scanner, with the
grammar poking around inside the input buffer and expecting things to
work the way they did in lex.

I will probably have to dive into the code more deeply, instead of
just mechanically fixing compilation warnings, which is mostly
what I've been doing so far.

As an aside, the original code very cavalierly converted int to pointer
and back, all over.  Over 40 years later, it's really hard to have
to mess with code like this.

Interestingly enough, though, when compiled in 32 bit, where int
and pointer are the same size, things seem to actually work!

Thanks,

Arnold
--
Aharon (Arnold) Robbins 		arnold AT skeeve DOT com
[Urrgh. The file handling in flex is quite different from lex. In lex
it's very simple, I think it just read a line at a time into a buffer,
in flex it reads large blocks and uses pointers to keep track of where
it is, with some cleverness if a token spans a block boundary. In lex
yytext is an array,in flex it's normally a pointer. -John]

Back to comp.compilers | Previous | NextPrevious 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