[mercury-users] read_line and lex (was: Many data elements using Mercury on cygwin?)

Douglas Auclair dauclair at msn.com
Fri Feb 7 03:58:02 AEDT 2003

Dear Ralph,

Thank you for your response.

From: Ralph Becket (rafe at cs.mu.OZ.AU)
>- you probably want to use read_line_as_string rather than read_line;

I prefer receiving the result as a list(char), not string, that's why I used 
read_line/3.  list(char) simplifies the scanning task for me.

>- many files can be read in their entirety and then processed (you'd  use 

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?

>- 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?  
Is there some (additional)documentation for it?  (I don't have extras in 
front of me, so I only see the lexer docs.)

Off topic:  are you going to write a tutorial on existential quantification 
and typing like your excellent tutorial you have on Mercury in general? :-)

Doug Auclair

MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
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