p-hatan/ mirror

pub repository

mirror.p-hatan.ir

petitparser

1.4.0

Dynamic parser combinator framework.

Download archive

Readme

PetitParser for Dart

Pub Package Build Status Coverage Status

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 scannnerless parsing, parser combinators, parsing expression grammars and packrat parsers to model grammars and parsers as objects that can be reconfigured dynamically.

This library is open source, stable and well tested. Development happens on GitHub. Feel free to report issues or create a pull-request there. General questions are best asked on StackOverflow.

An introductionary tutorial is part of the class documentation.

Basic Usage

Installation

Add the dependency to your package's pubspec.yaml file:

dependencies:
  petitparser: ">=1.0.0 <2.0.0"

Then on the command line run:

$ pub get

To PetitParser in your Dart code write:

import 'package:petitparser/petitparser.dart';

Examples

The package comes with a large collections of grammars and language experiments ready to explore:

  • lib/dart.dart contains an experimental Dart grammar.
  • lib/json.dart contains a complete JSON grammar and parser.
  • lib/lisp.dart contains a complete Lisp grammar, parser and evaluator:
  • example/lisphell contains a command line lisp interpreter.
    • example/lispweb contains a web based lisp interpreter.
    • lib/smalltalk.dart contains a complete Smalltalk grammar.

Furthermore, there are various open source projects using PetitParser:

  • dart-xml is a lightweight library for parsing, traversing, and querying XML documents.
  • Haml.dart is an implementation of Haml in Dart.
  • RythmDart is a rich featured, high performance template engine.
  • SharkDart is a small template engine.

Misc

History

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.

Ports

License

The MIT License, see LICENSE.

Changelog

Installing

export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add petitparser
pubspec.yaml
name: petitparser
version: 1.4.0
author: Lukas Renggli <renggli@gmail.com>
description: Dynamic parser combinator framework.
homepage: https://github.com/renggli/dart-petitparser
environment:
  sdk: '>=1.8.0 <2.0.0'
dev_dependencies:
  test: '>=0.12.1 <0.13.0'

Version history

VersionPublishedArchiveSHA-256
0.1.02012-10-23T18:16:56.176760ZDownloadf54c4ff1366ffdc5b4bf9786b6d809aca48118a1a51f813ba0aaf146507d1f0f
0.2.02012-12-18T17:13:46.500870ZDownloada6f3d4f81c07aaf77bc4e6c271e8cd16d1de24920234b7104a0bd4598f0a2fcb
0.2.12013-01-17T19:12:51.736850ZDownload560e323ca680bb215dcb354821cb1020dfa35a07118e368cf53095227b11782c
0.2.2+m32013-01-23T19:20:57.023750ZDownloadf7a5556334db97017a64231fd2797e07035f494bae0b65ac79de14e1705ae7d4
0.2.3+m32013-03-04T07:47:59.328190ZDownload3c555c58a64405abaf402b5ce2620e91f5b06420a4be2c1cc2baf0cfa5df765a
0.2.4+m42013-03-20T04:02:03.085030ZDownloadd3c7d873f43d35990598d7d2694fa9d8d0fe466c12b055bc0c03881ad77502bf
0.2.5+m42013-04-11T18:45:58.734330ZDownload6b2d59b917f4e6fc5d1ac9667fb983917056fd10e913f6e0bbd157817c6a92d9
0.3.02013-04-17T18:57:29.265130ZDownload57ebc797dfe3686f97dbe0afe6bbf38281120ad0088dfbb683d99a5218d0e398
0.4.02013-04-29T22:09:19.837990ZDownload912ce5f47d56893cca55fb0dc9ffb32094c652f04929bf5d21c3dd16dadb3d1e
0.4.12013-05-02T20:23:06.978340ZDownloadb05875e99ae10481bbd1499d7cebf3aa60f634cf23dd8c61fc13f36cab40b77b
0.4.22013-05-20T10:06:25.835800ZDownload9781136a9c8f200d1408fd569dbd172776891a6027f1bdec92bda7345a2b9e27
0.4.32013-05-30T19:05:27.659710ZDownload6ffea950edf9e56f102b35283343aee730aa456d483dd425f0b005538462ec4e
0.5.02013-07-03T20:34:16.666390ZDownload5fe185f5956a814dc7f43edce6f8161246d06f6e93200b207d66c056e9911ddc
0.5.12013-08-02T22:02:52.142070ZDownload60787a806b5572af688194b287cc2a6049a17417c351bebc034e815db6f3003b
0.5.22013-08-15T08:27:56.517430ZDownloada8eb809ce0295b395432e51f13a003a777e88e369f412bf662cf6a787096f7e0
0.5.32013-09-09T15:07:36.207320ZDownload58faced45be6614412dae2a43df5067ddb06455a8fcbf6eef9ec6a9051226127
0.5.42013-09-17T11:49:05.269910ZDownloadf082cafefc15f0a9cbef5d9fc2194160f2c6c0a35385454192394ff6b721c731
0.5.52013-10-05T09:55:28.974950ZDownloadff7e2e742af0ee2f64293dc8324a0bc7a185ff550fa52fa7f02ab3c46204841c
0.5.62013-10-29T07:19:20.308840ZDownload2dda7e9b3b84644a4e0f59bbf4c0147fed48696660ae5fe28ae2091a0e5d96c7
0.5.72013-11-07T18:18:43.058070ZDownload24d14d94697a5374cd072c392e284cac58223d98b06d5c369d0413a1e20daf0e
1.0.02013-11-08T21:19:16.954210ZDownloadb3728c601c3aa31e2571f4a801ac73f0a0a603f95c074f49aee34a477862ca01
1.0.12014-01-07T17:04:30.124690ZDownloadeda0d023bb7c07a0c578d2cb2b4ccb218dfbf74a30da83dadba855e00898527d
1.1.02014-02-09T21:31:14.770470ZDownload8a3b7d51f3c0b4ee61600058a0bfca5643ed186fb60e1e60927b114d51d855c1
1.1.12014-02-28T07:36:55.844440ZDownloadf637a759a3adabcefac48d632f902a528d6eeaa264943ce74ff23e1cc5d98b04
1.1.22014-04-21T18:03:59.118710ZDownload9f87252b392806ff20b5514b43dc041cfb6e05c326d1082c119a3c754b4f43de
1.1.32014-05-17T17:53:13.184250ZDownload6c4a24f45ad4e2c85cc2b813946c3daa92f458d7419bdb9359a59cad39d4cea4
1.2.02014-07-06T14:47:20.271230ZDownloada4add18fa4709a3cf1ba26de158bf18eef598b54a2a85de5047f4883f50386a0
1.2.12014-08-01T17:32:20.171550ZDownloadeff26935e49ed1bd2cb80c7a800d0d9006b8a44d00a75c46df52949ef0c813ff
1.2.22014-08-16T10:27:32.560340ZDownloade312bc7b1925154f9532b56420460a28bbfd8065df9722d22a8eb38251811e5d
1.3.02014-11-15T14:01:56.751460ZDownload1fb3cbd841cac9d42d2a639e228d6b329270cee1050c52ade752656fea58fe55
1.3.12014-11-29T08:13:28.023970ZDownload2885cb5892fb538d4d991bc9fb3293a371b9cf36778c3b7eb72eabdf0c155d0c
1.3.22014-12-14T11:01:49.298150ZDownload2aba483ab5b87dc68c1f1e9c265ca9bae5a267c69efea95ec180d4ad9f14a190
1.3.32014-12-27T17:57:12.368800ZDownload7c6ba4652bd9ecdb3e6893dea48de98456329838c3ac17990eabf4c7393f5f42
1.3.42015-01-23T21:00:41.840690ZDownload3d9b4f60f8c4aa745cc6114ec23711137c69fbdf24b49f41c123b5890266a3a8
1.3.62015-02-11T08:49:12.415680ZDownloadce4e39f601b64b02adfe07b95eb409a2439a12a3d2f7a348a9993c8b75adeb32
1.3.72015-02-27T18:39:53.288380ZDownloadc0aab2cd35c85877b623bb6a0d5556a482680874ab77bf2c2c403fc5ca2c8749
1.4.02015-05-15T11:51:10.014ZDownload2f8eb930944f1e9138077cf38f9d82f024c57efdcdf8950a6b7e7eaefe0da08d
1.4.12015-05-15T16:06:56.876ZDownload5414728596a07e38592ab87b1a19643cdbdbf5ce580747c291d33e680b4e1780
1.4.22015-05-17T09:44:54.966ZDownload6fc9effe307f31c6ad2fb465ace78eaddeaa8cff3becde5101befb4d9c3ec17b
1.4.32015-05-17T15:37:38.002ZDownload49af578832195bba5d2e48ff58a8b89c8504e42c7c5f35c67bfb404752ac4c4f
1.5.02015-10-06T18:08:39.912ZDownload763239e6b0009e9276a90d11c0a179c871967f87cbfe694d0b673a8ab540a4e5
1.5.12016-01-17T10:08:08.791ZDownload620dbddfcc3b83fc327e0249e33eb5ba4c91c178775bdfb0b88e6424294e3746
1.5.22016-04-05T10:22:08.428ZDownload99a1ec032d9b3d5cd73a8f36d5c1d64a0d213bbada1b093d4d04698adbc08c5b
1.5.32016-04-05T10:34:18.270ZDownloadf20cbc743ce54b11127e74653edf8efebbe5929e340f4ab1142d81c662d6b090
1.5.42016-10-17T15:25:21.622ZDownload63a945886e32d1b32e6c4f58221b428591b5795da4c39f0ac40de461ab25f9b0
1.5.52017-07-04T11:17:05.473346ZDownload32ce3727e2eb402c82e5f6638b75f50dbfc94f8ed999e1606c779a0c25b10ada
1.6.02017-08-04T20:09:18.176831ZDownloadeb050332bda8182b0cb9a5dd2d6804be3ee6c136cd180faf5f26e3c36cd10f74
1.6.12017-08-31T21:30:05.922015ZDownloadccc2ef030855d102a0f8c02e1889eec6507359a7d879f39fba63041932c76f1b
1.7.02017-12-19T19:55:11.595620ZDownloadf1c072036ca2ee6bb19b363febfd7076bd38f61430bac8359fd4ac50b11b15c5
1.7.12018-03-08T19:08:27.354961ZDownloadbc50c1eba95cc564cebee90c793436eba637e45995106355423282bcf2ad45e2
1.7.22018-03-08T19:34:22.645002ZDownloadf22f3ffdef00a793a3b38e96a41a399384c09da8e8df34bd7ee2c9d41fb1abb9
1.7.32018-03-08T19:37:35.602492ZDownloadbe43ac2a3c2dfe79dfeceeff9e9eb3f467876e2767f7ac554d34a959237b7397
1.7.42018-03-09T12:32:00.941207ZDownloadacdbaba7ce6b2f4ef95479ea98c5fd1a76d198f5588f3da6814af3f4c31eb936
1.7.52018-03-09T22:24:56.411460ZDownload6fc8914c448dfe59594f6dcefda65bae29caa6420b9f9929f13f1edcf7bd4191
1.7.62018-03-15T08:43:01.044334ZDownloadad187be44d18a5965f8cc129af6e360ce8e3cc11f81b93085dbde0e7cca38571
1.7.72018-07-21T14:08:33.941326ZDownload1884c28ad0060c2b0a3b9ddef5a6986c07494d62786c670816d174bbc0f87575
2.0.02018-08-01T18:47:52.414261ZDownload2b5c9e2f1cb33441b156ceeedfa82d1b3e892510f03b78278c1cc88a4df1f343
2.0.12018-09-15T19:29:06.877263ZDownload034cc842fff1ee473f8124da502414282896e3471c52322464e9b213d5c81ad5
2.0.22018-09-27T14:09:05.849616ZDownload528516f16e35b0aed538b145feb79e1f610165c9ab10c5508e499c88689071a7
2.1.02019-01-07T21:27:38.118964ZDownload059ae18865269fdf10d25afe5a2d3379efa710fd23d471fa52fca4439511d23c
2.1.12019-01-24T14:39:52.212011ZDownload108c94d0766fb1afa42228af753f53d085d9bdd6dc3aef607ca5c58f4d6496a5
2.2.02019-02-27T20:29:54.952683ZDownload2ccfcf4be74d4427a47b1df466d7ac3027797680068a0e86a4f7633d2a569c3a
2.2.12019-03-07T06:19:05.828783ZDownload1f4f9ab4bbb08398b8e4bb0943016283d9b08a5f738661d588b2ec8b3010cbdf
2.3.02019-05-10T13:32:28.094817ZDownload80c100878a233febeb8678825c8d0ad513fe349889897a9cf89334d37236cc7e
2.4.02019-06-28T20:15:28.073171ZDownload4525e4341c9aabc4023700abff9b2e26f969dff9476ddf8f40de63ee5748acab
3.0.02020-01-01T09:59:43.151919ZDownload382799fb2c795cd0eac17db2a4a88df01c098a248ca4e6ae456f52019b5f9cb1
3.0.12020-02-12T10:46:56.868354ZDownloada6adb2f6edd16883b5bd36c667b0cf895cb3553fe2e274dc277b6cdedeaace98
3.0.22020-03-30T17:33:45.672316ZDownload5d409b6c77f0fcf944034a1d2a13afbc3297bd34f05771aed2193bf15814c039
3.0.32020-05-30T07:27:08.796109ZDownload3817f3d6d36048c60b1a5d0f48866d0f428d031616caeb16705e21e6f6682239
3.0.42020-05-30T10:07:04.173553ZDownload6802205ca621e6d2d2fc315d89491a685c33a16bf82875327aab0295afb3ec4f
3.1.02020-07-18T09:25:27.838333ZDownloadfe07f9345bf03ff0c881d1f5494e20cc40206780ca5dea86aab8037cb49af5f2
4.0.0-nullsafety2020-09-07T16:56:25.699722ZDownload641666f59c207a4104d3deec59db627d4368aa3415ccb9982ecc7dc6802d7d57
4.0.0-nullsafety.12020-11-21T07:57:07.968835ZDownload12576308c0232b8a2acc6b66710c4920ed760f4466f5dee63ff7c6782633019b
4.0.02021-02-17T21:44:05.867149ZDownload3aac98525056d0ae4b397245d9523e51f3326b8fcd83d14bdd186435c6ec4b77
4.0.12021-02-19T10:50:55.719144ZDownload88917a76a71fc578cfdbeb44b4da718c4c4e098de6a41153c200825195b80e53
4.0.22021-02-19T13:22:00.265489ZDownloadf725a68581f744b9cdc680e525a20fb86491053bf5ee23562e0d6ea3ee1c173c
4.1.02021-04-05T15:37:16.055645ZDownload85e8f8b118afcccf948a9844d199e56260117400bd9b9982d87bf1d62ebc1690
4.2.02021-06-05T14:12:12.269755ZDownload3abc4a0f06dccb2348ebdab9f5b9cc88bb64bfc830bed6351040ca42722044a6
4.3.02021-09-10T18:32:53.045212ZDownloadb1e35bcd00e0ab63a4883d7d76461da7477dcac3ab82fa0ab894be729d579032
4.4.02021-10-16T08:24:26.114183ZDownload1a914995d4ef10c94ff183528c120d35ed43b5eaa8713fc6766a9be4570782e2
5.0.02022-03-11T14:55:52.026405ZDownload2ebb289dc4764ec397f5cd3ca9881c6d17196130a7d646ed022a0dd9c2e25a71
5.1.02022-10-23T15:14:59.189671ZDownload49392a45ced973e8d94a85fdb21293fbb40ba805fc49f2965101ae748a3683b4
5.2.02023-02-19T11:25:06.902830ZDownload32e46db8021f6d027d9221b937653f5c8aa043e0dc093998e18331912f22936b
5.3.02023-03-05T13:16:58.372115ZDownloada9346a3fbba7546a28374bdbcd7f54ea48bb47772bf3a7ab4bfaadc40bc8b8c6
5.4.02023-04-24T11:27:43.900104ZDownloadcb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
6.0.02023-08-17T19:22:40.433530ZDownload54e61005585962c9cb6f0df05a3ed82453e01deb1b1f83833b0b6cf7eab93da4
6.0.12023-08-20T10:07:28.358866ZDownloadeeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6
6.0.22023-11-30T10:30:42.598779ZDownloadc15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
6.1.02025-01-12T10:15:53.275595ZDownload07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646
7.0.02025-06-15T14:26:01.701287ZDownload9436fe11f82d7cc1642a8671e5aa4149ffa9ae9116e6cf6dd665fc0653e3825c
7.0.12025-08-16T09:33:44.998191ZDownload1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1
7.0.22026-02-14T10:03:01.017261ZDownload91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675
7.1.02026-09-27T06:29:16.945839ZDownload2f1564aadb14215e478563b5406cb80729d022158c01dc50c96013c2f7eb4790

Dependencies

No direct dependencies declared.