Can parser combinators be made efficient?

I’ve come up with a Haskell solution that is 30× faster than the Haskell solution you posted (with my concocted test expression). Major changes: Change Parsec/String to Attoparsec/ByteString In the fact function, change read & many1 digit to decimal Made the chainl1 recursion strict (remove $! for the lazier version). I tried to keep everything … Read more

Use Scala parser combinator to parse CSV files

What you missed is whitespace. I threw in a couple bonus improvements. import scala.util.parsing.combinator._ object CSV extends RegexParsers { override protected val whiteSpace = “””[ \t]”””.r def COMMA = “,” def DQUOTE = “\”” def DQUOTE2 = “\”\”” ^^ { case _ => “\”” } def CR = “\r” def LF = “\n” def CRLF … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)