petitparser 0.5.0
petitparser: ^0.5.0 copied to clipboard
Dynamic parser combinator framework.
PetitParser for Dart #
Grammars for programming languages are traditionally specified statically. They are hard to compose and reuse due to ambiguities that inevitably arise. PetitParser combines ideas from scannerless parsing, parser combinators, parsing expression grammars and packrat parsers to model grammars and parsers as objects that can be reconfigured dynamically.
The library is open source, stable and well tested. No breaking API changes are expected in the main library. Development happens on GitHub. Feel free to report issues or create a pull-request there. General questions are best asked on StackOverflow.
Continuous build results are available from Jenkins. An introductionary tutorial is part of the class documentation.
The package comes with a large collections of grammars and language experiments ready to explore:
lib/dart.dartcontains an experimental Dart grammar.lib/json.dartcontains a complete JSON grammar and parser.lib/lisp.dartcontains a complete Lisp grammar, parser and evaluator:example/lisphellcontains a command line lisp interpreter.example/lispwebcontains a web based lisp interpreter.lib/smalltalk.dartcontains a complete Smalltalk grammar.
lib/xml.dartcontains a complete XML parser and AST.
PetitParser was originally implemented in Smalltalk. Later on, as a mean to learn these languages, I reimplemented PetitParser in Java and Dart. The implementations are very similar in their API and the supported features. If possible, the implementations adopt best practises of the target language.