Walter Bright Wrote: > Ellery Newcomer wrote: > > ANTLR has pretty good support for backtracking, so writing a D grammar > > for it wasn't too difficult, but then the resultant performance isn't > > anything near what I'd like. > > My recommendation is to forget about parser generators and just build > one by hand. They're easy to write, and you won't have speed problems > with them. There are other advantages, too, like better error messages > and error recovery.
Walter is 110% correct. Over the years I've expended enormous amounts of energy with parser generators esp. with trying to get good error messages and error recovery (exactly as Walter suggests). Nearly every time I went back to a hand-written lexer and recursive descent parser. To see the KISS principle in action, take a look at Walter's DMDScript internals: lexer.d and parser.d. Cheers Justin Johansson