Hi all, I am using "parsec" to parse the output from "xmame -listinfo"
wich is a list of records of the form

game (
   attr1 value1
   ...
   attrN valueN
)

and for approx. 3500 records I got ~250 mb of RSS memory during parsing,
wich takes 20 seconds on my athlon 1400.

I think that I must have done something wrong (this is the first time I
use parsec), here is my parser:

--- Begin
games = many game

game = 
    do
    openGame
    x <- manyTill attribute closeGame
    return (mkGameInfo x)

attribute = 
    do
    whitespaces
    x <- identifier
    whitespaces
    y <- tillEOL
    return (x,y)

openGame = 
    do
    string "game ("
    newline

closeGame = 
    do
    string ")"
    newline
    newline

whitespace = "\v\f\t\r "
whitespaces = skipMany (oneOf whitespace)

tillEOL = manyTill anyChar newline

identifier = many alphaNum
--- End

Thanks for any advice

Vincenzo
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to