Friday, January 28, 2011

Parser monad versus parser generation

I have been playing with a parser monad for the last two months. Then last week I hesitated to ditch it and bring back a traditional parser generator (fsyacc) with the twist of using monadic code to be able to delay constructions such as auto indentation that had caused me trouble earlier.
Well I need to say that I decided to stay with the parser monad. I had three reasons:
  1. Having refactored the monadic parser it is pretty readable and looks as good as yacc syntaxes I've wrote. In any case it is no longer worse.
  2. I learned a few new tricks during this refactoring that were fundamental "monadic" tricks. As this is much of an educational exercise, sticking with the monadic parser will teach me more.
  3. Monads have a differential relation to lambda calculus and "equational" relations are the theme of this blog!

No comments: