A Meta-Grammar for PEG Parsers
This week we make the parser generator “self-hosted”, meaning the parser generator generates its own parser.
[This is part 7 of my PEG series. See the Series Overview for the rest.]
So we have a parser generator, a piece of which is a parser for grammars. We could call this a meta-parser. The meta-parser works similar to the generated parsers:
GrammarParser inherits from
Parser, and it uses the same
expect() machinery. However, it is hand-written. But does it have to be?