I'm looking for additional examples of using PetitParser beyond 开发者_Python百科PPArithmeticParser and PPLambdaParser that are provided in the tests package and a couple of blog posts by Lukas? If anyone's willing to share theirs, it would be much appreciated.
Updated: https://github.com/NicolasPetton/jtalk/blob/master/st/parser.st
Updated: https://github.com/dmatveev/waste/blob/master/wastex.stKeep 'em coming!
Have a look at the official PetitParser code repository, there are many grammars ready to download:
- PetitCSV
- PetitJson (well tested, builds Smalltalk objects)
- PetitMSE
- PetitManifestMf
- PetitRegex
- PetitSQL
- PetitSmalltalk (well tested, can be used as a replacement for the refactoring engine parser)
- PetitXml (well tested)
Additionally you find various PetitParser grammars on SqueakSource. Just search for 'PetitParser' as a keyword and you find more or less complete grammars for Java, JavaScript, Ada, SQL, and some others.
There are a lot of small nice examples on PetitParsers Google+ site.
- Quickly extract all JavaDoc comments from a file
- Parse 'self', but not variables like 'selfish' or 'selfism'
- A PetitParser grammar that only accepts an even number of a's and b's
- Parse a non context-free language
- Parse floating point numbers
- Parse nestable Haskell comments
- ...
精彩评论