Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PhiLia093: Parser Generator

There are two ways to write a parser: a hand-written recursive descent parser or one generated by a parser generator such as ANTLR4 or YACC/Bison. The former is very flexible but usually not very elegant, while the latter offers better maintainability but requires in-depth knowledge of parser generation. Felys originally used a hand-written parser but later migrated to a customized parser generator that also bootstraps itself. This section will discuss how to build a PEG parser generator along with a lexer generator.