Partager via


A Monadic Pratt Parser

A while ago I read the book Beautiful Code which contains articles from several well known programmers about what code they consider beautiful. There is an article in this book by Douglas Crockford called titled Top Down Operator Precedence. The article is about a type of parser called either a Pratt Parser (named after Vaughan Pratt person who wrote the paper on it) or Top Down Operator Precedence parsing. What makes this parsing technique interesting is that your semantic actions are defined in terms of the tokens (or syntax) of the language. I find this a very neat and clear way to write a parser... Continue Reading...