If you find yourself parsing an input complex enough to require more than three lines of a BNF grammar, check out the Spirit library that is a part of boost. In short, Spirit allows you to specify your input's grammar in a psuedo-EBNF syntax, and that specification is the parser. It's powerful stuff; I'm using it in my current project.
The concept of lexer, parser, and compiler generators is not new - lex and yacc have been around longer than most of us - but I think this library is more flexible. It's inline with the rest of my code, and I can choose to manipulate just text instead of dealing with a whole syntax tree.
This, of course, only applies If you are already working in C++, or you have the option of using it.
The concept of lexer, parser, and compiler generators is not new - lex and yacc have been around longer than most of us - but I think this library is more flexible. It's inline with the rest of my code, and I can choose to manipulate just text instead of dealing with a whole syntax tree.
This, of course, only applies If you are already working in C++, or you have the option of using it.