| Parser combinators is what I've been loving in the last few years. Pros:
* They're just a technique/library that you can use in your own language without the seperate generation step. * They're simple enough that I often roll my own rather than using an existing library. * They let you stick code into your parsing steps - logging, extra information, constructing your own results directly, e.g. * The same technique works for lexing and parsing - just write a parser from bytes to tokens, and a second parser from tokens to objects. * Depending on your languages syntax, you can get your parser code looking a lot like the bnf grammar you're trying to implement. Cons:
* You will eventually run into left-recursion problems. It can be nightmarish trying to change the code so it 'just works'. You really need to step back and grok left-recursion itself - no handholding from parser combinators. * Same thing with precedence - you just gotta learn how to do it. Fixing left-recursion didn't click for me until I learned how to do precedence. |