Monadic C Parsing in Haskell
#haskell #projects #parsingThe first real programming language that I was taught during my undergraduate was C, and I quickly became infatuated with it - there's something inherently enjoyable in the feeling that it provides of dragging complex abstractions out of nothing but basic program instructions.
While this lead to me developing several projects in C (various graph algorithms, most examples from the interfaces and implementations book, a handrolled regex engine, an xml parser, a cross-platform threading library, a b-tree), it wasn't long before I ended up hitting against the expressivity limitations of the language itself (leading to projects such as a manual hack to allow asynchronous cooperative threads, implementing first-class-functions by reifying functions into structs, implementing oop manually).
This eventually bubbled up in a inexplicable desire to implement a preprocessor for C, that would allow me to use custom syntax to concisely express the manual tricks that I had experimented with before. But, unfortunately, as I soon found out, I had no idea how a compiler worked, and so I realised I first had to work out how to parse C before I could even think about implementing extensions to C.
This began me on my first foray into programming languages research (and may have even contributed to why I'm even where I am now), learning about monads, parser combinators etc.
You can find the project at: parsing-in-haskell