Home > Archive > Compilers > November 2007 > lex/flex and source correspondence
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
lex/flex and source correspondence
|
|
| parthaspanda22@gmail.com 2007-11-06, 7:19 pm |
| A flex generated scanner could decide to store the entire input file
in memory. That way, a single buffer can be used in several places in
the tool chain that uses a scanner.
Is this an idea that has been explored and thought of as unworthy?
I know that multiple input files could increase the size of the
buffer(s) but hey, we are living in the age of 100s of MB of main
memory.
Sincerely.
[This is a very old idea. Turbo Pascal buffered full source files in
RAM in the 1980s. -John]
| |
|
| On Nov 6, 8:54 am, parthaspand...@gmail.com wrote:
> A flex generated scanner could decide to store the entire input file
> in memory. That way, a single buffer can be used in several places in
> the tool chain that uses a scanner. ...
> [This is a very old idea. Turbo Pascal buffered full source files in
> RAM in the 1980s. -John]
The C preprocessor of gcc also buffers entire files, or at least did
in the version I studied some years ago. It used a hand-coded
scanner, however, not lex/flex.
| |
| Thomas Dickey 2007-11-30, 4:28 am |
| parthaspanda22@gmail.com wrote:
> A flex generated scanner could decide to store the entire input file
> in memory. That way, a single buffer can be used in several places in
> the tool chain that uses a scanner.
> Is this an idea that has been explored and thought of as unworthy?
> I know that multiple input files could increase the size of the
> buffer(s) but hey, we are living in the age of 100s of MB of main
> memory.
> Sincerely.
> [This is a very old idea. Turbo Pascal buffered full source files in
> RAM in the 1980s. -John]
Either lex or flex can do this by redefining the input/outputs.
However, flex can be used to support multiple parsers (by restricting
the exported symbols), while for lex it's (ahem) doable but not
simple.
Regarding buffering full source files - even as main memory's
increased, there are still text files that people want to edit which
are larger. So it's not a universal solution...
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
|
|
|
|
|