petitparser
A dynamic parser framework to build efficient grammars and parsers quickly.
7.0.2
1000K downloads/mo
#73 most downloaded on pub.dev
petitparser/dart-petitparser
What this package is like to depend on
Last release 6 months ago
14 Feb 2026
Release timing varies
gaps range from 2 weeks to 1.1 years
Some releases are documented
notes for 42 of 90 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
92 releases · first in 2012
1 release in the last 12 months
see the full history below
Release timeline
92 releases · Oct 2012 to Feb 2026Releases
latest 60 of 92-
7.0.214 Feb 2026Release notes
Open source →- Numerous fixes and improvements to documentation and examples.
- Add a constant parser
Parser.constant(Object value)that can be used to return a constant value. - Add a linter rule to detect duplicate parsers.
-
7.0.116 Aug 2025Release notes
Open source →- Dart and Flutter 3.9 compatibility.
- Minor optimization to repeating character parsers.
- Assertion on looping trim parser.
-
7.0.015 Jun 2025Release notes
Open source →- Dart 3.8 requirement.
- Support for unicode character parsing in all relevant character parsers.
- Most character parser constructors now uniformly support the following named arguments (breaking-change):
message:to customize the default error message;ignoreCase:to accept lower- and upper-case variations; andunicode:to decode surrogate pairs and instead of UTF-16 only.
- For consistency and better flexibility in the future, replaced optional arguments to a named ones in various other constructors:
Parser.flatten({String message}),Parser.not({String message}),Parser.neg({String message}),Parser.end({String message}),Parser.starString([String? message]),Parser.plusString({String? message}),Parser.timesString(int count, {String? message}),Parser.repeatString(int min, int max, {String? message}),failure({String message}),newline({String message}),undefined({String message})(breaking-change). - Cleanup, simplifications, and optimizations to the codebase.
- Removal of long deprecated code.
-
6.1.012 Jan 2025Release notes
Open source →- Improve documentation and fix broken links.
- Prevent infinite recursion in repeating parsers.
- Improve performance of case-insensitive string matching and the permutation parser.
- Make the
loopbackvariable in the expression builder public (thanks to joranmulderij). - Fix various bugs in equality testing of character predicates (thanks to North101).
-
6.0.230 Nov 2023Nothing published for this version
-
6.0.120 Aug 2023 -
6.0.017 Aug 2023Release notes
Open source →- Dart 3.0 requirement.
- Use Dart Records for typed sequences:
- Add convenience converter:
(char('a'), char('b')).toSequenceParser() - And extension methods to emulate the old
Sequenceclasses, deprecate old accessors.
- Add convenience converter:
- Make
Resulta sealed class to be able to pattern matchSuccessandFailure.- Removed the unused generic type of
Failure, which is of typeResult<Never>now. - Deprecated
isSuccessandisFailure, instead use the more efficientis Successandis Failureoperators.
- Removed the unused generic type of
- Reintroduce
hasSideEffectinMapParserand consider callbacks to be side-effect free by default. - The above changes give typical parser speed improvements between 10% and 30%.
-
5.4.024 Apr 2023Release notes
Open source →- Dart 2.19 requirement, enabled strict casts and type inference.
- Introduce repeating character parser
starString,plusString,timesStringandrepeatStringfor extra fast reading of strings. - Renamed
AnyParsertoAnyCharacterParser, andCharacterParsertoSingleCharacterParserfor consistency. - Add support for optional expression groups in the
ExpressionBuilder. - Optimize, cleanup, and improve code and documentation.
- Add
optimizeto in-place optimize parser graphs.
-
5.3.005 Mar 2023Release notes
Open source →- Maintenance release deprecating some old code in anticipation of the upcoming major release.
- Deprecate the old way of defining primitive parsers and move the functionality directly to
ExpressionBuilder. - Deprecate
GrammarDefinition.build(Function, List<Object?>), usebuildFrom(Parser)for a strongly typed parser instead. - Replace various uses of exception throwing with assertions, which yields code the compiler can optimize better.
-
5.2.019 Feb 2023Release notes
Open source →- Add
@useResultto parser constructors to avoid bugs when using the old parser instance. - Add a linter rule to detect unoptimized flatten parsers.
- Add
-
5.1.023 Oct 2022Release notes
Open source →- Dart 2.18 requirement.
- Add
seq2,seq3, ... combinator functions returning strongly typed sequences ofSequence2<R1, R2>,Sequence3<R1, R2, R3>, ... - Add
Parser.starSeparated,Parser.plusSeparated,Parser.timesSeparated, andParser.repeatSeparatedreturningSeparatedListwith the strongly typed elements and separators. Deprecate the dynamically typedParser.separatedBy. - Add
Parser.matchesAllthat creates a lazy iterable over the (overlapping or non-overlapping) successful parse results. DeprecatematchesandmatchesSkipping. - Add a native platform independent
newlineparser. - Add a section on debugging to the tutorial.
- Remove the deprecated
ref0,ref1, ... instance methods, these methods are globally defined since 4.2.0. - Make
GrammarDefinitionandGrammarDefinition.start()optionally typed.
-
5.0.011 Mar 2022Release notes
Open source →- Dart 2.16 requirement.
- Moved PetitParser examples to a separate Git repository: https://github.com/petitparser/dart-petitparser-examples.
- Add a
skiphelper that silently consumes input before and/or after another parser. - Make the
ExpressionBuilder<T>statically typed. This requires existing code to specify the desired result type, and provide all reduction actions. - Deprecate
hasSideEffectinMapParserby considering all callbacks to have side-effects, the benefit of the added complications is negligible. - Add
charIgnoringCase, and provide better standard error messages for character parsers. - Add initial support for indentation based grammars.
-
4.4.016 Oct 2021Release notes
Open source →- Dart 2.15 requirement.
- Add a
PatternParserthat allows to use any DartPatternas a parser. - Greatly improve the test coverage of all code to 98%.
-
4.3.010 Sep 2021Release notes
Open source →- Dart 2.14 requirement.
- Add a
labeledparser, that allows to add a debug label to the parser graph. - Extract
Predicate<T>andCallback<T>function types to shared file. - Change debug functions to named arguments, and generate output events with first class objects instead of strings.
- Various improvements to the
Analyzer:- Compute all deeply referenced children.
- Compute all paths or the shortest path between parsers.
- Fix inaccuracies in character parser documentation and tutorial.
- Add more grammar linter rules that detect common bugs.
-
4.2.005 Jun 2021Release notes
Open source →- Dart 2.13 requirement.
ref0,ref1,ref2, ... is now also usable outside ofGrammarDefinition.- Use
resolveto inline all the referenced parsers, which now also works withSettableParser. - Deprecated
removeSettables, that is superseded by the more powerfulresolveoperation.
- Use
- Add the possibility to join multiple
Tokenand transform their values. - Add
Analyzerto compute nullability, as well as first-, follow-, and cycle-sets of parsers. - Add a
linterthat performs a series of checks on grammar graphs. - Expand the tutorial with a section on testing.
-
4.1.005 Apr 2021Release notes
Open source →- Add the option to select the failure join strategy on
ChoiceParserparsers:selectLastis the default strategy, reporting the failure of the last parser tried.selectFarthestreports the parser failure the farthest down in the input string, preferring later failures to earlier ones.selectFarthestJoinedis the same as above, but joins error messages that happen at the same position.
- Properly type all delegate parsers in choice, sequence, repeat, action, ...
- Fix typing in
transformParserand its users (debug tools, optimizers). To fix type your transformation function. - Fix typing of
GrammarDefinitionand reference parsers. To take advantage replace uses ofrefwithref0,ref1, ... - Deprecate
GrammarParser, a no longer needed wrapper aroundGrammarDefinition. Callbuild()on the definition to get the parser.
- Fix typing in
- Improve documentation and add a tutorial section on
GrammarDefinition.
- Add the option to select the failure join strategy on
-
4.0.219 Feb 2021Nothing published for this version
-
4.0.119 Feb 2021Nothing published for this version
-
4.0.017 Feb 2021Release notes
Open source →- Dart 2.12 requirement and null-safety.
Success.messagethrows anUnsupportedErrorexception, instead of returningnull.DelegateParserhas been made abstract to avoid a concrete class in-between abstract classes.Parser.delegate()has been removed, useParser.settable()as an equivalent replacement.Parser.optional()is now returningParser<T?>, to provide a non-null default value useParser.optionalWith(T value).Parser.not()is now returning the failureParser<Failure>as success value, instead ofnull.epsilon()is now returningParser<void>, to provide a non-null default value useepsilonWith(T value).- Removed const constructor from
Parserhierarchy, as most parsers are inherently mutable and having some constant makes things inconsistent and more complicated than necessary.
-
4.0.0-nullsafety.121 Nov 2020 pre-releaseNothing published for this version
-
4.0.0-nullsafety07 Sep 2020 pre-releaseNothing published for this version
-
3.1.018 Jul 2020Release notes
Open source →- Fix missing type information on
eofandfailureparser. - Optimize character predicates by using lookup tables.
- Improvements to documentation and examples.
- Fix missing type information on
-
3.0.430 May 2020Nothing published for this version
-
3.0.330 May 2020Nothing published for this version
-
3.0.230 Mar 2020Nothing published for this version
-
3.0.112 Feb 2020Nothing published for this version
-
3.0.001 Jan 2020Release notes
Open source →- Dart 2.7 compatibility and requirement (extension methods).
- New features:
String.toParser()enables creating efficient string and character parsers more easily.Iterable.toChoiceParser()andIterable.toSequenceParser()enables creating parsers from collections more easily.Parser.callCC(Function)enables capturing a parse continuation more easily.
- Restructure the internal code to be more modular:
- The
Parserclass now only defines a few core methods, everything else is an extension method. - As long as you continue to import
package:petitparser/petitparser.dartnone of the changes should affect existing code. - Parser implementations have been moved to
package:petitparser/parser.dart. - Helpers to parse and extract data has been moved to
package:petitparser/matcher.dart. - The expression builder has been moved to
package:petitparser/expression.dart. - The grammar builder has been moved to
package:petitparser/definition.dart.
- The
- Breaking changes:
Parseris no longer aPattern, but can be converted to one withtoPattern.anyInhas been removed in favor of the already existing and equivalentanyOfparser.pickandpermuteare defined onParser<List>, thus they won't be available on the more genericParser<dynamic>any longer. Prefix the operators with acastListoperator.
-
2.4.028 Jun 2019Release notes
Open source →- Dart 2.4 compatibility and requirement.
- More tight typing, more strict linter rules.
- Documentation improvements.
-
2.3.010 May 2019Release notes
Open source →- Dart 2.3 compatibility and requirement.
- The expression builder supports building expression with parenthesis.
- Improved the documentation on greedy and lazy parsers.
- Add a prolog parser and interpreter example.
- Numerous optimizations and improvements.
-
2.2.107 Mar 2019Nothing published for this version
-
2.2.027 Feb 2019Release notes
Open source →- Dart 2.2 compatibility and requirement.
- Parser implements the
Patterninterface. - Add an example of the expression builder to the tutorial.
- Introduce a fast-parse mode that avoids unnecessary memory allocations during parsing.
-
2.1.124 Jan 2019Nothing published for this version
-
2.1.007 Jan 2019Release notes
Open source →- Rename ParserError to ParserException, and make it an Exception.
- Simplify the
EndOfInputParserand theListParser. - Add a
PositionParserthat produces the current input position. - Constructor assertions across the stack.
-
2.0.227 Sep 2018Nothing published for this version
-
2.0.115 Sep 2018Nothing published for this version
-
2.0.001 Aug 2018Release notes
Open source →- Make parsers fully typed, where it makes sense.
- In most cases this should have no effect on existing code, but sometimes can point out actual bugs.
- In rare cases, it might be necessary to insert
cast<R>orcastList<R>at the appropriate places.
- Move examples into their own example package.
- Make parsers fully typed, where it makes sense.
-
1.7.721 Jul 2018Nothing published for this version
-
1.7.615 Mar 2018 -
1.7.509 Mar 2018Release notes
Open source →- Dart 2.0 strong mode compatibility.
- Removed deprecated code, and empty beta package.
- Reformatted all code using dartfmt.
-
1.7.409 Mar 2018Nothing published for this version
-
1.7.308 Mar 2018Nothing published for this version
-
1.7.208 Mar 2018Nothing published for this version
-
1.7.108 Mar 2018Nothing published for this version
-
1.7.019 Dec 2017Release notes
Open source →- Dart 2.0 compatibility.
- Fixed numerous analyzer warnings.
- Generate better default error messages.
- Moved example grammars to examples.
-
1.6.131 Aug 2017 -
1.6.004 Aug 2017Release notes
Open source →- Migrate to micro libraries.
- Move Smalltalk, Json, Dart and Lisp grammars to examples.
-
1.5.504 Jul 2017 -
1.5.417 Oct 2016 -
1.5.305 Apr 2016 -
1.5.205 Apr 2016 -
1.5.117 Jan 2016 -
1.5.006 Oct 2015Release notes
Open source →- Update documentation to match the style guide.
- Change library names.
- Add optimizations and tests for the Dart language grammar.
- Improve comments.
- Better error-handling and primitives for Lisp command line app.
- Fix unicode parsing in the JSON parser.
- Add browser back to dev_dependencies.
-
1.4.317 May 2015Release notes
Open source →- Restore the CompositeParser class.
- Add more references to open source projects using PetitParser.
-
1.4.217 May 2015Release notes
Open source →- Integrate the tutorial into the README.
- Improve formatting of README code blocks.
-
1.4.115 May 2015Release notes
Open source →- Improve test coverage.
- Bump minimum SDK to 1.8.0.
- Remove deprecated CompositeParser class.
-
1.4.015 May 2015Release notes
Open source →- Migrate from unittest to test.
- Setup Travis.
- Allow for const GrammarDefinitions.
- Fix typo in docs.
- Clean up the JSON grammar.
- Format the benchmarks.
-
1.3.727 Feb 2015Release notes
Open source →- Cleanup dependencies:
- browser is now
>=0.10.0 <0.11.0. - unittest is now
>=0.11.0 <0.12.0. - Remove explicit dependency on matcher package.
- browser is now
- Make the JSON parser twice as fast.
- Reformat tests.
- Cleanup dependencies:
-
1.3.611 Feb 2015 -
1.3.423 Jan 2015 -
1.3.327 Dec 2014