Rico made some more interesting posts in his parser performance quiz, first producing a parser where the predicates are compiled into an in memory representation and also a parser where he produces IL on the fly. He talks about them here and here respectively.
So I ported both of these parsers to F#; as they demonstrate some nice uses of patterns commonly used in ML, such as take one data structure that is easy to read and transforming it into another than is easy to evaluate. This gives us 6 parsers in total, so wrote little test harness so I could hold a great parser shoot out. I had to alter Rico’s parsers slightly to fit them into my test harness, but the sprit of the code remains very much the same. All this code is can be downloaded here. I want to take a slightly more holistic view of things, so I’m going to take a look at three areas, the size, structure and modularity of the code base, the scalability of the parsers, and their speed.