3 ms·
Using Haskell and a parser combinator would probably be the easiest
by smabie 6y ago
Using Haskell and a parser combinator would probably be the easiest
- enriquto 6y agoEasier for whom? Most programmers would not be able to follow that code. On the other hand, a really simple C or Python algorithm is more or less universally readable.
- eru 6y agoIt's not so much about the algorithm, but the parsing itself. Parser combinators give you one of the most straightforward ways to express parsers. You are right, that the language you express your parser combinators in vs the language you express an alternative solution in also will have an impact. You can in theory express parser combinators in Python. But it's gonna be a bit ugly, because Python has relatively clunky syntax for functions. Some people have tried writer parser combinator libraries for eg JavaScript. See https://github.com/GregRos/parjs https://github.com/GregRos/parjs I just found a parser combinator library for Python https://pypi.org/project/parsita/ https://pypi.org/project/parsita/ But it looks like they have to abuse some Python magic to make the code readable.
- enriquto 6y agoAlright, but jpeg decoding is nearly all algorithm, there's almost no parsing. Do you have a particular haskell jpeg decoder in mind that uses parser combinators?
- eru 6y agoNo. But the author of the original comment mentioning Haskell https://news.ycombinator.com/item?id=23841865 https://news.ycombinator.com/item?id=23841865 might have had?