Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where could I find more examples of using PetitParser? [closed]

I'm looking for additional examples of using PetitParser beyond 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.st

Keep 'em coming!

like image 850
Boris Slobodin Avatar asked Apr 18 '11 13:04

Boris Slobodin


2 Answers

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.

like image 138
Lukas Renggli Avatar answered Oct 21 '22 04:10

Lukas Renggli


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
  • ...
like image 41
Helene Bilbo Avatar answered Oct 21 '22 03:10

Helene Bilbo