I recently started writing a simple lexer and parser.
It turned out that the lexer is easier to prescribe manually. But the parser was a bit more complicated. My parser created by Bison worked almost immediately from a quarry, and it gave me many useful messages about where I forgot about the state. I later wrote the same parser manually, but it took me a lot more debugging before I worked fine.
The appeal of creating tools for lexers and parsers is that you can write the specification in a clean, easy-to-read language that is close to the shortest possible execution of your specification. A handwritten parser is usually at least twice as large. In addition, an automated parser (/ lexer) comes with a lot of diagnostic code and logic to help you debug this thing.
The parser / lexer specifier in a language like BNF is also much easier to change if your language or requirements change. If you are dealing with a handwritten parser / lexer, you may need to look deep into your code and make significant changes.
Finally, since they are often implemented as end state machines without backtracking (gazillions of options on Bison, so this is not always specified), it is possible that your automatically generated code will be more efficient, encoded product.
Carl Smotricz
source share