{"id":19065075,"url":"https://github.com/petitparser/dart-petitparser-examples","last_synced_at":"2025-04-28T11:25:33.235Z","repository":{"id":61915367,"uuid":"426569009","full_name":"petitparser/dart-petitparser-examples","owner":"petitparser","description":"Examples of PetitParser for Dart.","archived":false,"fork":false,"pushed_at":"2024-07-30T12:39:03.000Z","size":1370,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-30T15:58:17.623Z","etag":null,"topics":["examples","parser","parser-combinators","petitparser"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petitparser.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-10T09:57:12.000Z","updated_at":"2024-07-30T12:39:23.000Z","dependencies_parsed_at":"2024-07-30T15:55:09.607Z","dependency_job_id":"2ba7ab76-cd5f-471b-af1f-e7b44d8dc485","html_url":"https://github.com/petitparser/dart-petitparser-examples","commit_stats":null,"previous_names":[],"tags_count":170,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitparser%2Fdart-petitparser-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitparser%2Fdart-petitparser-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitparser%2Fdart-petitparser-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petitparser%2Fdart-petitparser-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petitparser","download_url":"https://codeload.github.com/petitparser/dart-petitparser-examples/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223772297,"owners_count":17199977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["examples","parser","parser-combinators","petitparser"],"created_at":"2024-11-09T00:48:31.554Z","updated_at":"2025-04-18T03:32:29.348Z","avatar_url":"https://github.com/petitparser.png","language":"Dart","readme":"PetitParser Examples\n====================\n\n[![Pub Package](https://img.shields.io/pub/v/petitparser_examples.svg)](https://pub.dev/packages/petitparser_examples)\n[![Build Status](https://github.com/petitparser/dart-petitparser-examples/actions/workflows/dart.yml/badge.svg?branch=main)](https://github.com/petitparser/dart-petitparser-examples/actions/workflows/dart.yml)\n[![Code Coverage](https://codecov.io/gh/petitparser/dart-petitparser-examples/branch/main/graph/badge.svg?token=TDwmzZtPdj)](https://codecov.io/gh/petitparser/dart-petitparser-examples)\n[![GitHub Issues](https://img.shields.io/github/issues/petitparser/dart-petitparser-examples.svg)](https://github.com/petitparser/dart-petitparser-examples/issues)\n[![GitHub Forks](https://img.shields.io/github/forks/petitparser/dart-petitparser-examples.svg)](https://github.com/petitparser/dart-petitparser-examples/network)\n[![GitHub Stars](https://img.shields.io/github/stars/petitparser/dart-petitparser-examples.svg)](https://github.com/petitparser/dart-petitparser-examples/stargazers)\n[![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/petitparser/dart-petitparser-examples/main/LICENSE)\n\nThis package contains examples to illustrate the use of [PetitParser](https://github.com/petitparser/dart-petitparser). A tutorial and full documentation is contained in the [package description](https://pub.dev/packages/petitparser) and [API documentation](https://pub.dev/documentation/petitparser/latest/). [petitparser.github.io](https://petitparser.github.io/) contains more information about PetitParser, running examples in the browser, and links to ports to other languages.\n\n## Examples\n\n### BibTeX\n\nA simple parser that reads a [BibTeX](https://en.wikipedia.org/wiki/BibTeX) file into a list of BibTeX entries with a list of fields.\n\n### Dart\n\nThis example contains the grammar of the Dart programming language. This is based on an early Dart 1.0 grammar specification and unfortunately does not support all valid Dart programs yet.\n\n### JSON\n\nThis example contains a complete implementation of [JSON](https://json.org/). It is a simple grammar that can be used for benchmarking with the native implementation.\n\n### Lisp\n\nThis example contains a simple grammar and evaluator for LISP. The code is reasonably complete to run and evaluate complex programs. Binaries for a Read–Eval–Print Loop (REPL) are provided for the console and the web browser.\n\n```bash\ndart run bin/lisp/lisp.dart\n```\n\n### Math\n\nThis example contains a simple evaluator for mathematical expressions, it builds a parse-tree that can then be used to print or evaluate expressions.\n\n### Pascal\n\nA complete pascal grammar following the Apple Pascal Standard from 1978.\n\n### Prolog\n\nThis example contains a simple grammar and evaluator for Prolog programs. The code is reasonably complete to run and evaluate basic prolog programs. Binaries for a Read–Eval–Print Loop (REPL) are provided for the console and the web browser.\n\n```bash\ndart run bin/prolog/prolog.dart\n```\n\n### Smalltalk\n\nThis example contains a complete implementation of the Smalltalk grammar. This is a verbatim export of a grammar that was originally developed for the PetitParser infrastructure in Smalltalk and that was the base of the [Helvetia Language Workbench](https://www.lukas-renggli.ch/smalltalk/helvetia).\n\n### URI\n\nThis is a simple grammar that takes an URL string and decomposes it into scheme, authority (including username, password, hostname, and port), path, query (including parameters as key-value pairs), and fragment.\n\n### XML\n\nThis examples parses XML files to events, creates and pretty-prints a DOM tree, and evaluates XPath expressions. Depends on [xml](https://github.com/renggli/dart-xml) package.\n\n## Web\n\nTo run the web examples execute the following commands from the command line and navigate to http://localhost:8080/:\n\n```bash\ndart pub global activate webdev\nwebdev serve --release\n```\n\n## Benchmarks\n\nTo run the benchmarks execute the following command from the command line:\n\n```bash\ndart run --no-enable-asserts bin/benchmark/benchmark.dart\n```\n\nEach benchmark prints the standard parsing performance, then the fast parsing performance (where return results are ignored), and possibly a native comparison (i.e. with regular expressions or native JSON parser). With the arguments `--confidence` or `--stderr` the respective variations are printed.\n\nTo only run the verification code use:\n\n```bash\ndart run bin/benchmark/benchmark.dart --no-benchmark\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetitparser%2Fdart-petitparser-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetitparser%2Fdart-petitparser-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetitparser%2Fdart-petitparser-examples/lists"}