Opening the book…
This concludes our tutorial of PetitParser. We have reviewed the following points:
- A parser is a composition of multiple smaller parsers combined with combinators.
- To parse a string, use the method
parse:. - To know if a string matches a grammar, use the method
matches:. - The method
flattenreturns a String from the result of the parsing. - The method
==>performs the transformation given in the block given in parameter. - Compose parsers (and create a grammar) by subclassing
PPCompositeParser. - Test your parser by subclassing
PPCompositeParserTest.
For a more extensive view of PetitParser, its concepts and implementation, the Moose book1 and Lukas Renggli’s PhD2 have both a dedicated chapter.
- http://www.themoosebook.org/book/internals/petit-parser
- http://scg.unibe.ch/archive/phd/renggli-phd.pdf
This page titled 17.7: Chapter Summary was last modified on Mon, 26 Jul 2021 15:16:56 GMT and is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Alexandre Bergel, Damien Cassou, Stéphane Ducasse, Jannik Laval (Square Bracket Associates) via source content that was edited to the style and standards of the LibreTexts platform.
The book could not be loaded just now.