May 8, 2007 at 5:43 PM
The compiler design is a well researched area of computer science. Typically, compiler designers use a parser generator framework like YACC or PCCTS to construct lexer, scanner, parser, and abstract syntax tree. With the arrival of expression templates and template meta-programming, it is possible to construct a parser by simply using the template meta-programming technique. The Spirit library is object-oriented recursive-decent parser implemented in C++ using expression templates and meta-programming. In Spirit the parser is constructed during the compile time using a combination of primitive parsers and fusing them through template meta-programming. TinyPascal is a practical application of Spirit framework.