Hapy is a runtime parser generator library. The Hapy library generates parsers from BNF-like language grammars. Parsing scripting languages and communication protocol messages are typical use cases.
Hapy goals and distinguishable features are:
The library generates parsers for context-free grammars. A grammar is specified directly in C++, using a simple EBNF-like interface (see also examples). Generated parsers are C++ objects that build parsing trees from input strings.
Hapy parsers are top-down parsers that use leftmost derivation of pushed input strings. Hapy parsers support full backtracking, with optional optimization in the form of user-specified commit points. Generated parsers automatically handle left recursion in grammars so that you do not have to eliminate it manually.
Parsing can be done iteratively, with the parsing tree extending with every new portion of the input. Hapy parsers can be configured to detect protocol message boundaries and invalid message prefixes in environments where "complete" input is not immediately available.
The Hapy library is written in straight C++ without non-standard dependencies.
Many parser generators exist. Most generators use off-line mode: their output is a piece of source code that must be compiled into the program during built time. The examples of such parsers are Yacc and LLGen. A few generators allow the programmer to generate parsers runtime, during the program execution. Runtime generation has a lot of advantages. It's primary disadvantage is the runtime parser generation overhead, but such overhead is negligible for most applications. Spirit, is a good example of a runtime parser generator library.
The Hapy library would not exist if Spirit would generate correct parsers by default, had data-push parsing interface, could recognize valid message prefixes, and would not take unreasonable amount of compilation time and/or bleeding-edge C++ compilers. While the last flaw is likely to disappear according to Moore's law, key Spirit design choices would keep it inappropriate for parsing communication protocol messages, one of the primary use cases for the Hapy library.