Blame README.md

Packit d0b620
# Welcome to the PEGTL
Packit d0b620
Packit d0b620
[![Release](https://img.shields.io/github/release/taocpp/PEGTL.svg)](https://github.com/taocpp/PEGTL/releases/latest)
Packit d0b620
[![Download](https://api.bintray.com/packages/taocpp/public-conan/pegtl%3Ataocpp/images/download.svg)](https://bintray.com/taocpp/public-conan/pegtl%3Ataocpp/_latestVersion)
Packit d0b620
[![TravisCI](https://travis-ci.org/taocpp/PEGTL.svg?branch=master)](https://travis-ci.org/taocpp/PEGTL)
Packit d0b620
[![AppVeyor](https://ci.appveyor.com/api/projects/status/pa5sbnw68tu650aq/branch/master?svg=true)](https://ci.appveyor.com/project/taocpp/PEGTL)
Packit d0b620
[![Doozer.io](https://doozer.io/badge/taocpp/PEGTL/buildstatus/master)](https://doozer.io/user/taocpp/PEGTL)
Packit d0b620
[![Coverage](https://coveralls.io/repos/github/taocpp/PEGTL/badge.svg?branch=master)](https://coveralls.io/github/taocpp/PEGTL)
Packit d0b620
Packit d0b620
The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency C++11 header-only parser combinator library for creating parsers according to a [Parsing Expression Grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) (PEG).
Packit d0b620
Packit d0b620
## Documentation
Packit d0b620
Packit d0b620
* [Version 2.x Documentation](doc/README.md)
Packit d0b620
* [Version 1.3 Documentation](https://github.com/taocpp/PEGTL/blob/1.3.x/doc/README.md)
Packit d0b620
Packit d0b620
## Introduction
Packit d0b620
Packit d0b620
Grammars 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).
Packit d0b620
Packit d0b620
A 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.
Packit d0b620
Here is an example of how a PEG grammar rule is implemented as C++ class with the PEGTL.
Packit d0b620
Packit d0b620
```c++
Packit d0b620
// PEG rule for integers consisting of a non-empty
Packit d0b620
// sequence of digits with an optional sign:
Packit d0b620
Packit d0b620
// integer ::= ( '+' / '-' )? digit+
Packit d0b620
Packit d0b620
// The same parsing rule implemented with the PEGTL:
Packit d0b620
Packit d0b620
using namespace tao::pegtl;
Packit d0b620
Packit d0b620
struct integer : seq< opt< one< '+', '-' > >, plus< digit > > {};
Packit d0b620
```
Packit d0b620
Packit d0b620
PEGs are superficially similar to Context-Free Grammars (CFGs), however the more deterministic nature of PEGs gives rise to some very important differences.
Packit d0b620
The included [grammar analysis](doc/Grammar-Analysis.md) finds several typical errors in PEGs, including left recursion.
Packit d0b620
Packit d0b620
## Design
Packit d0b620
Packit d0b620
The PEGTL is designed to be "lean and mean", the core library consists of approximately 6000 lines of code.
Packit d0b620
Emphasis is on simplicity and efficiency, preferring a well-tuned simple approach over complicated optimisations.
Packit d0b620
Packit d0b620
The 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. Whether/which actions are taken, and whether/which data structures are created during a parsing run, is entirely up to the user.
Packit d0b620
Packit d0b620
Included 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.
Packit d0b620
Packit d0b620
Through 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.
Packit d0b620
Packit d0b620
With the PEG formalism, the separation into lexer and parser stages is usually dropped -- everything is done in a single grammar.
Packit d0b620
The rules are expressed in C++ as template instantiations, and it is the compiler's task to optimise PEGTL grammars.
Packit d0b620
Packit d0b620
## Status
Packit d0b620
Packit d0b620
Each commit is automatically tested with multiple architectures, operating systems, compilers, and versions thereof.
Packit d0b620
Packit d0b620
* Windows
Packit d0b620
Packit d0b620
  * Visual Studio 2015 (x86, x64)
Packit d0b620
  * Visual Studio 2017 (x86, x64)
Packit d0b620
  * MinGW (i686), GCC 5.x
Packit d0b620
  * MinGW-w64 (i686), GCC 5.x, 6.x
Packit d0b620
  * MinGW-w64 (x86_64), GCC 6.x
Packit d0b620
Packit d0b620
* Mac OS X / macOS (using libc++)
Packit d0b620
Packit d0b620
  * Mac OS X 10.10, Xcode 6.4
Packit d0b620
  * Mac OS X 10.11, Xcode 7.3
Packit d0b620
  * macOS 10.12, Xcode 8.3
Packit d0b620
  * macOS 10.13, Xcode 9.3
Packit d0b620
Packit d0b620
* Linux (using libstdc++)
Packit d0b620
Packit d0b620
  * Debian 8 (i386), GCC 4.9
Packit d0b620
  * Ubuntu 12.04 LTS (amd64), Clang 3.4, 3.7
Packit d0b620
  * Ubuntu 14.04 LTS (amd64), GCC 4.8, 4.9, 5.x, 6.x, 7.x, 8.x
Packit d0b620
  * Ubuntu 14.04 LTS (amd64), Clang 3.5, 3.6, 3.8, 3.9, 4.x, 5.x, 6.x
Packit d0b620
  * Ubuntu 14.04 LTS (i386, amd64), GCC 4.8
Packit d0b620
  * Ubuntu 16.04 LTS (i386, amd64, armhf, arm64), GCC 5.x
Packit d0b620
  * Fedora 24 (x86_64), GCC 6.x
Packit d0b620
  * Fedora 24 (x86_64), Clang 3.8
Packit d0b620
Packit d0b620
* Android
Packit d0b620
Packit d0b620
  * Android 4.4 "KitKat" (API level 19)
Packit d0b620
  * Android 5.1 "Lollipop" (API level 22)
Packit d0b620
  * Android 6.0 "Marshmellow" (API level 23)
Packit d0b620
  * Android 7.0 "Nougat" (API level 24)
Packit d0b620
Packit d0b620
Additionally, each commit is checked with GCC's and Clang's sanitizers, as well as [`valgrind`](http://valgrind.org/)
Packit d0b620
and [`clang-tidy`](http://clang.llvm.org/extra/clang-tidy/). Code coverage is automatically measured and the unit tests
Packit d0b620
cover 100% of the core library code (for releases).
Packit d0b620
Packit d0b620
[Releases](https://github.com/taocpp/PEGTL/releases) are done in accordance with [Semantic Versioning](http://semver.org/).
Packit d0b620
Incompatible API changes are *only* allowed to occur between major versions.
Packit d0b620
For details see the [changelog](doc/Changelog.md).
Packit d0b620
Packit d0b620
## Thank You
Packit d0b620
Packit d0b620
* Christopher Diggins and the YARD parser for the general idea.
Packit d0b620
* George Makrydakis for the [inspiration](https://github.com/irrequietus/typestring) to `TAO_PEGTL_STRING`.
Packit d0b620
* Johannes Overmann for his invaluable [`streplace`](https://code.google.com/p/streplace/) command-line tool.
Packit d0b620
* Jörg-Christian Böhme for improving the Android CI build.
Packit d0b620
* Kai Wolf for help with CMake.
Packit d0b620
* Kenneth Geisshirt for Android compatibility and Android CI.
Packit d0b620
* Kuzma Shapran for EOL testing and fixes.
Packit d0b620
* Michael Becker for help with CMake.
Packit d0b620
* Paul Le Roux for CMake improvements and Conan support.
Packit d0b620
* Paulo Custodio for Windows-related fixes.
Packit d0b620
* Sam Hocevar for contributing Visual Studio 2015 compatibility.
Packit d0b620
* Stephan Beal for the bug reports, suggestions and discussions.
Packit d0b620
* Stuart Dootson for `mmap_input<>` support on Windows.
Packit d0b620
* Sven Johannsen for help with CMake.
Packit d0b620
* Zhihao Yuan for fixing several warnings when compiling with Visual Studio 2015.
Packit d0b620
Packit d0b620
## Contact
Packit d0b620
Packit d0b620
The PEGTL is part of [The Art of C++](https://taocpp.github.io/).
Packit d0b620
Packit d0b620
For questions and suggestions regarding the PEGTL, success or failure stories, and any other kind of feedback, please feel free to contact the authors at `taocpp(at)icemx.net`.
Packit d0b620
Packit d0b620
## License
Packit d0b620
Packit d0b620
The PEGTL is certified [Open Source](http://www.opensource.org/docs/definition.html) software. It may be used for any purpose, including commercial purposes, at absolutely no cost. It is distributed under the terms of the [MIT license](http://www.opensource.org/licenses/mit-license.html) reproduced here.
Packit d0b620
Packit d0b620
> Copyright (c) 2007-2018 Dr. Colin Hirsch and Daniel Frey
Packit d0b620
>
Packit d0b620
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
Packit d0b620
>
Packit d0b620
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Packit d0b620
>
Packit d0b620
> 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 AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.