ABNF Parser Generator
This is the grammar that was used to build a scannerless C++ preprocessor in a previous release of APG. The greatest challenge was handling the #if directive. In fact, the "repeat-until" operator was developed there specifically for this task, leading to the first superset of ABNF operators (SABNF). Since then, the "repeat-until" operator has been identified as a special case of syntactic predicates. This grammar has been modified to used the PEG form of syntactic predicates.
This is essentially the preprocessor grammar from ISO/IEC 14882:2003(E) , Appendix A.14 written in SABNF notation and rearranged for the prioritized-choice disambiguation rule. The "if-section", "elif-section" and "else-section" rules use syntactic predicates.
C++ Preprocessor Input String
A simple C++ code file.