{"id":13419829,"url":"https://github.com/taocpp/PEGTL","last_synced_at":"2025-03-15T05:33:23.031Z","repository":{"id":24986546,"uuid":"28405090","full_name":"taocpp/PEGTL","owner":"taocpp","description":"Parsing Expression Grammar Template Library","archived":false,"fork":false,"pushed_at":"2024-09-28T12:43:49.000Z","size":6508,"stargazers_count":1936,"open_issues_count":4,"forks_count":229,"subscribers_count":65,"default_branch":"main","last_synced_at":"2024-10-29T15:07:19.844Z","etag":null,"topics":["cpp","cpp11","cpp17","grammar","header-only","parser-combinators","parsing","parsing-expression-grammar","parsing-expression-grammars","peg","pegtl"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taocpp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE_1_0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-12-23T15:29:50.000Z","updated_at":"2024-10-28T17:34:46.000Z","dependencies_parsed_at":"2023-02-16T23:15:41.356Z","dependency_job_id":"7ff8320e-b821-42a8-bbf8-01c0c319e82d","html_url":"https://github.com/taocpp/PEGTL","commit_stats":{"total_commits":2909,"total_committers":46,"mean_commits":63.23913043478261,"dds":0.3269164661395668,"last_synced_commit":"68f446153c5c736035dbee1286e788f904006add"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taocpp%2FPEGTL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taocpp%2FPEGTL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taocpp%2FPEGTL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taocpp%2FPEGTL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taocpp","download_url":"https://codeload.github.com/taocpp/PEGTL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243690112,"owners_count":20331726,"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":["cpp","cpp11","cpp17","grammar","header-only","parser-combinators","parsing","parsing-expression-grammar","parsing-expression-grammars","peg","pegtl"],"created_at":"2024-07-30T22:01:21.575Z","updated_at":"2025-03-15T05:33:23.024Z","avatar_url":"https://github.com/taocpp.png","language":"C++","readme":"# Welcome to the PEGTL\n\n[![Windows](https://github.com/taocpp/PEGTL/actions/workflows/windows.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/windows.yml)\n[![macOS](https://github.com/taocpp/PEGTL/actions/workflows/macos.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/macos.yml)\n[![Linux](https://github.com/taocpp/PEGTL/actions/workflows/linux.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/linux.yml)\n[![Android](https://github.com/taocpp/PEGTL/actions/workflows/android.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/android.yml)\n\u003cbr\u003e\n[![clang-analyze](https://github.com/taocpp/PEGTL/actions/workflows/clang-analyze.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/clang-analyze.yml)\n[![clang-tidy](https://github.com/taocpp/PEGTL/actions/workflows/clang-tidy.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/clang-tidy.yml)\n[![Sanitizer](https://github.com/taocpp/PEGTL/actions/workflows/sanitizer.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/sanitizer.yml)\n[![CodeQL](https://github.com/taocpp/PEGTL/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/taocpp/PEGTL/actions/workflows/codeql-analysis.yml)\n[![Codecov](https://codecov.io/gh/taocpp/PEGTL/branch/main/graph/badge.svg?token=ykWa8RRdyk)](https://codecov.io/gh/taocpp/PEGTL)\n\nThe Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++ header-only parser combinator library for creating parsers according to a [Parsing Expression Grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) (PEG).\n\nDuring development of a new major version the main branch can go through incompatible changes. For a stable experience please download [the latest release](https://github.com/taocpp/PEGTL/releases) rather than using the main branch.\n\n## Documentation\n\n* [Changelog](doc/Changelog.md)\n* [Development](doc/README.md) (requires C++17)\n* [Version 3.x](https://github.com/taocpp/PEGTL/blob/3.x/doc/README.md) (requires C++17)\n* [Version 2.x](https://github.com/taocpp/PEGTL/blob/2.x/doc/README.md) (requires C++11)\n* [Version 1.x](https://github.com/taocpp/PEGTL/blob/1.x/doc/README.md) (requires C++11)\n\n## Contact\n\nFor questions and suggestions regarding the PEGTL, success or failure stories, and any other kind of feedback, please feel free to open a [discussion](https://github.com/taocpp/PEGTL/discussions), an [issue](https://github.com/taocpp/PEGTL/issues) or a [pull request](https://github.com/taocpp/PEGTL/pulls), or contact the authors at `taocpp(at)icemx.net`.\n\n## Introduction\n\nGrammars are written as regular C++ code, created with template programming (not template meta programming), i.e. nested template instantiations that naturally correspond to the inductive definition of PEGs (and other parser-combinator approaches).\n\nA comprehensive set of [parser rules](doc/Rule-Reference.md) that can be combined and extended by the user is included, as are mechanisms for debugging grammars, and for attaching user-defined [actions](doc/Actions-and-States.md) to grammar rules.\nHere is an example of how a parsing expression grammar rule is implemented as C++ class with the PEGTL.\n\n```c++\n// PEG rule for integers consisting of a non-empty\n// sequence of digits with an optional sign:\n\n// sign ::= '+' / '-'\n// integer ::= sign? digit+\n\n// The same parsing rule implemented with the PEGTL:\n\nusing namespace tao::pegtl;\n\nstruct sign : one\u003c '+', '-' \u003e {};\nstruct integer : seq\u003c opt\u003c sign \u003e, plus\u003c digit \u003e \u003e {};\n```\n\nPEGs are superficially similar to Context-Free Grammars (CFGs), however the more deterministic nature of PEGs gives rise to some very important differences.\nThe included [grammar analysis](doc/Grammar-Analysis.md) finds several typical errors in PEGs, including left recursion.\n\n## Design\n\nThe PEGTL is designed to be \"lean and mean\", the core library consists of approximately 6000 lines of code.\nEmphasis is on simplicity and efficiency, preferring a well-tuned simple approach over complicated optimisations.\n\nThe PEGTL is mostly concerned with parsing combinators and grammar rules, and with giving the user of the library (the possibility of) full control over all other aspects of a parsing run.\nWhether/which actions are taken, and whether/which data structures are created during a parsing run, is entirely up to the user.\n\nIncluded are some [examples](doc/Contrib-and-Examples.md#examples) for typical situation like unescaping escape sequences in strings, building a generic [JSON](http://www.json.org/) data structure, and on-the-fly evaluation of arithmetic expressions.\n\nThrough the use of template programming and template specialisations it is possible to write a grammar once, and use it in multiple ways with different (semantic) actions in different (or the same) parsing runs.\n\nWith the PEG formalism, the separation into lexer and parser stages is usually dropped -- everything is done in a single grammar.\nThe rules are expressed in C++ as template instantiations, and it is the compiler's task to optimise PEGTL grammars.\n\n## Status\n\nEach commit is automatically tested with multiple architectures, operating systems, compilers, and versions thereof.\n\nEach commit is checked with the GCC and Clang [sanitizers](https://github.com/google/sanitizers), Clang's [Static Analyzer](https://clang-analyzer.llvm.org/), and [`clang-tidy`](http://clang.llvm.org/extra/clang-tidy/).\nAdditionally, we use [CodeQL](https://securitylab.github.com/tools/codeql) to scan for (security) issues.\n\nCode coverage is automatically measured and the unit tests cover 100% of the core library code (for releases).\n\n[Releases](https://github.com/taocpp/PEGTL/releases) are done in accordance with [Semantic Versioning](http://semver.org/).\nIncompatible API changes are *only* allowed to occur between major versions.\n\n## Thank You\n\nIn appreciation of all contributions here are the people that have [directly contributed](https://github.com/taocpp/PEGTL/graphs/contributors) to the PEGTL and/or its development.\n\n[\u003cimg alt=\"amphaal\" src=\"https://avatars.githubusercontent.com/u/13903151\" width=\"120\"\u003e](https://github.com/amphaal)\n[\u003cimg alt=\"anand-bala\" src=\"https://avatars.githubusercontent.com/u/7420072\" width=\"120\"\u003e](https://github.com/anand-bala)\n[\u003cimg alt=\"andoma\" src=\"https://avatars.githubusercontent.com/u/216384\" width=\"120\"\u003e](https://github.com/andoma)\n[\u003cimg alt=\"barbieri\" src=\"https://avatars.githubusercontent.com/u/1838\" width=\"120\"\u003e](https://github.com/barbieri)\n[\u003cimg alt=\"bjoe\" src=\"https://avatars.githubusercontent.com/u/727911\" width=\"120\"\u003e](https://github.com/bjoe)\n[\u003cimg alt=\"bwagner\" src=\"https://avatars.githubusercontent.com/u/447049\" width=\"120\"\u003e](https://github.com/bwagner)\n[\u003cimg alt=\"cdiggins\" src=\"https://avatars.githubusercontent.com/u/1759994\" width=\"120\"\u003e](https://github.com/cdiggins)\n[\u003cimg alt=\"clausklein\" src=\"https://avatars.githubusercontent.com/u/1833050\" width=\"120\"\u003e](https://github.com/clausklein)\n[\u003cimg alt=\"delpinux\" src=\"https://avatars.githubusercontent.com/u/35096584\" width=\"120\"\u003e](https://github.com/delpinux)\n[\u003cimg alt=\"dkopecek\" src=\"https://avatars.githubusercontent.com/u/1353140\" width=\"120\"\u003e](https://github.com/dkopecek)\n[\u003cimg alt=\"gene-hightower\" src=\"https://avatars.githubusercontent.com/u/3957811\" width=\"120\"\u003e](https://github.com/gene-hightower)\n[\u003cimg alt=\"irrequietus\" src=\"https://avatars.githubusercontent.com/u/231192\" width=\"120\"\u003e](https://github.com/irrequietus)\n[\u003cimg alt=\"jedelbo\" src=\"https://avatars.githubusercontent.com/u/572755\" width=\"120\"\u003e](https://github.com/jedelbo)\n[\u003cimg alt=\"joelfrederico\" src=\"https://avatars.githubusercontent.com/u/458871\" width=\"120\"\u003e](https://github.com/joelfrederico)\n[\u003cimg alt=\"johelegp\" src=\"https://avatars.githubusercontent.com/u/21071787\" width=\"120\"\u003e](https://github.com/johelegp)\n[\u003cimg alt=\"jovermann\" src=\"https://avatars.githubusercontent.com/u/6087443\" width=\"120\"\u003e](https://github.com/jovermann)\n[\u003cimg alt=\"jubnzv\" src=\"https://avatars.githubusercontent.com/u/12023585\" width=\"120\"\u003e](https://github.com/jubnzv)\n[\u003cimg alt=\"kelvinhammond\" src=\"https://avatars.githubusercontent.com/u/1824682\" width=\"120\"\u003e](https://github.com/kelvinhammond)\n[\u003cimg alt=\"kneth\" src=\"https://avatars.githubusercontent.com/u/1225363\" width=\"120\"\u003e](https://github.com/kneth)\n[\u003cimg alt=\"kuzmas\" src=\"https://avatars.githubusercontent.com/u/1858553\" width=\"120\"\u003e](https://github.com/kuzmas)\n[\u003cimg alt=\"lambdafu\" src=\"https://avatars.githubusercontent.com/u/1138455\" width=\"120\"\u003e](https://github.com/lambdafu)\n[\u003cimg alt=\"lichray\" src=\"https://avatars.githubusercontent.com/u/433009\" width=\"120\"\u003e](https://github.com/lichray)\n[\u003cimg alt=\"michael-brade\" src=\"https://avatars.githubusercontent.com/u/8768950\" width=\"120\"\u003e](https://github.com/michael-brade)\n[\u003cimg alt=\"mkrupcale\" src=\"https://avatars.githubusercontent.com/u/13936020\" width=\"120\"\u003e](https://github.com/mkrupcale)\n[\u003cimg alt=\"newproggie\" src=\"https://avatars.githubusercontent.com/u/162319\" width=\"120\"\u003e](https://github.com/newproggie)\n[\u003cimg alt=\"obiwahn\" src=\"https://avatars.githubusercontent.com/u/741109\" width=\"120\"\u003e](https://github.com/obiwahn)\n[\u003cimg alt=\"ohanar\" src=\"https://avatars.githubusercontent.com/u/1442822\" width=\"120\"\u003e](https://github.com/ohanar)\n[\u003cimg alt=\"pauloscustodio\" src=\"https://avatars.githubusercontent.com/u/70773\" width=\"120\"\u003e](https://github.com/pauloscustodio)\n[\u003cimg alt=\"pleroux0\" src=\"https://avatars.githubusercontent.com/u/39619854\" width=\"120\"\u003e](https://github.com/pleroux0)\n[\u003cimg alt=\"quadfault\" src=\"https://avatars.githubusercontent.com/u/30195320\" width=\"120\"\u003e](https://github.com/quadfault)\n[\u003cimg alt=\"quarticcat\" src=\"https://avatars.githubusercontent.com/u/70888415\" width=\"120\"\u003e](https://github.com/quarticcat)\n[\u003cimg alt=\"ras0219\" src=\"https://avatars.githubusercontent.com/u/533828\" width=\"120\"\u003e](https://github.com/ras0219)\n[\u003cimg alt=\"redmercury\" src=\"https://avatars.githubusercontent.com/u/4424222\" width=\"120\"\u003e](https://github.com/redmercury)\n[\u003cimg alt=\"robertcampion\" src=\"https://avatars.githubusercontent.com/u/4220569\" width=\"120\"\u003e](https://github.com/robertcampion)\n[\u003cimg alt=\"samhocevar\" src=\"https://avatars.githubusercontent.com/u/245089\" width=\"120\"\u003e](https://github.com/samhocevar)\n[\u003cimg alt=\"sanssecours\" src=\"https://avatars.githubusercontent.com/u/691989\" width=\"120\"\u003e](https://github.com/sanssecours)\n[\u003cimg alt=\"sgbeal\" src=\"https://avatars.githubusercontent.com/u/235303\" width=\"120\"\u003e](https://github.com/sgbeal)\n[\u003cimg alt=\"skyrich62\" src=\"https://avatars.githubusercontent.com/u/23705081\" width=\"120\"\u003e](https://github.com/skyrich62)\n[\u003cimg alt=\"studoot\" src=\"https://avatars.githubusercontent.com/u/799344\" width=\"120\"\u003e](https://github.com/studoot)\n[\u003cimg alt=\"svenjo\" src=\"https://avatars.githubusercontent.com/u/1538181\" width=\"120\"\u003e](https://github.com/svenjo)\n[\u003cimg alt=\"wickedmic\" src=\"https://avatars.githubusercontent.com/u/12001183\" width=\"120\"\u003e](https://github.com/wickedmic)\n[\u003cimg alt=\"wravery\" src=\"https://avatars.githubusercontent.com/u/6502881\" width=\"120\"\u003e](https://github.com/wravery)\n[\u003cimg alt=\"zhihaoy\" src=\"https://avatars.githubusercontent.com/u/43971430\" width=\"120\"\u003e](https://github.com/zhihaoy)\n\n## The Art of C++\n\nThe PEGTL is part of [The Art of C++](https://taocpp.github.io/).\n\n[\u003cimg alt=\"colinh\" src=\"https://avatars.githubusercontent.com/u/113184\" width=\"120\"\u003e](https://github.com/colinh)\n[\u003cimg alt=\"d-frey\" src=\"https://avatars.githubusercontent.com/u/3956325\" width=\"120\"\u003e](https://github.com/d-frey)\n[\u003cimg alt=\"uilianries\" src=\"https://avatars.githubusercontent.com/u/4870173\" width=\"120\"\u003e](https://github.com/uilianries)\n\n## License\n\n\u003ca href=\"https://opensource.org/licenses/BSL-1.0\"\u003e\u003cimg align=\"right\" src=\"https://opensource.org/wp-content/uploads/2009/06/OSIApproved.svg\" width=\"150\" hspace=\"20\" alt=\"Open Source Initiative\"\u003e\u003c/a\u003e\n\nCopyright (c) 2007-2023 Daniel Frey and Dr. Colin Hirsch\n\nThe PEGTL is certified [Open Source](http://www.opensource.org/docs/definition.html) software.\nIt is [licensed](https://pdimov.github.io/blog/2020/09/06/why-use-the-boost-license/) under the terms of the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt) reproduced here.\n\n\u003e Boost Software License - Version 1.0 - August 17th, 2003\n\u003e\n\u003e Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the \"Software\") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:\n\u003e\n\u003e The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.\n\u003e\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":["TODO scan for Android support in followings","Miscellaneous","C++","Generic ##","排序","Parsing Expression Grammars","Libraries"],"sub_categories":["多项混杂","Misc"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaocpp%2FPEGTL","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaocpp%2FPEGTL","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaocpp%2FPEGTL/lists"}