[Haskell-cafe] parsebinaryoperations

Ryan Bloor ryanbloor at hotmail.com
Sun Dec 9 04:58:29 EST 2007

I have a function parseInt... which needs an error guard for when the input is not an Int.
parseInt :: ParserparseInt [] = []parseInt xs = let (digits, rest) = span isDigit (removeSpace xs)                in [(EInt (read digits), removeSpace rest)]
Also... I have a function that does this... parseBinaryOp "+" "(5 + 2) if"      gives...[(Int 5, Int 2, "if")]
so, op is '+' or "&&". I am unsure of how to begin... 
parseBinaryOp :: String -> String -> [(Expr, Expr, String)]parseBinaryOp op str
Celeb spotting – Play CelebMashup and win cool prizes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071209/72ae94f6/attachment.htm

More information about the Haskell-Cafe mailing list