[mercury-users] read_line and lex (was: Many data elements using Mercury on cygwin?)
Simon Taylor
stayl at cs.mu.OZ.AU
Fri Feb 7 09:31:59 AEDT 2003
On 07-Feb-2003, Douglas Auclair <dauclair at msn.com> wrote:
> From: Ralph Becket (rafe at cs.mu.OZ.AU)
> >- many files can be read in their entirety and then processed (you'd use
> >read_file_as_string);
Any use of read_file_as_string for files which are not known to
be small adds an unnecessary and easily avoided fixed limit to
your program,
> Okay, but these files are big: one is 12 meg, another 2 meg, and three
> others at 1 meg, 1/2 meg and 1/2 meg -- my point in using read_line/3 was
> to collect only the subset of information I need. Will the OS (cygwin) and
> the Mercury runtime be able to handle all that?
Possibly, but the way you are doing it is better.
> >- you should seriously consider using lex in extras: it would make
> >reading and parsing your file a trivial matter.
>
> Thanks. I'll look into lex. As I write scanners and parsers quite often,
> this particular task was already trivial for me (each line follows the same
> format, and each line had at most 15 columns, only 3 of which I care
> about), but if lex is a time-saver I'll use that instead. What about the
> lexer module in the library, does it use lex, or are the two entirely
> disjoint?
They're disjoint -- library/lexer.m is a hand-coded lexer for
Mercury terms.
> Is there some (additional)documentation for it? (I don't have
> extras in front of me, so I only see the lexer docs.)
The documentation is in the extras distribution.
Simon.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list