Refactoring to FParsec

I have been playing around with FParsec a little bit lately, inspired by the chapter 8 “Functional Parsers” of the book Programming in Haskell by Graham Hutton. FParsec is an F# parser combinator library for building quite powerful parsers by combining primitive parsers and functions provided by the FParsec library.

If you haven’t been exposed to the concept of functional monadic parsers then this can be a very different experience. I am still totally fascinated by the power and the simplicity of this concept. Here is a brief introduction in C#.

As an exercise and to learn the usage of FParsec I have been looking for code that could be refactored to FParsec.

Continue reading →