PEGTL | Parsing Expression Grammar Template Library | Parser library

 by   taocpp C++ Version: 3.2.7 License: BSL-1.0

kandi X-RAY | PEGTL Summary

kandi X-RAY | PEGTL Summary

PEGTL is a C++ library typically used in Utilities, Parser applications. PEGTL has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

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). A comprehensive set of parser rules that can be combined and extended by the user is included, as are mechanisms for debugging grammars, and for attaching user-defined actions to grammar rules. Here is an example of how a PEG grammar rule is implemented as C++ class with the PEGTL. PEGs are superficially similar to Context-Free Grammars (CFGs), however the more deterministic nature of PEGs gives rise to some very important differences. The included grammar analysis finds several typical errors in PEGs, including left recursion.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              PEGTL has a medium active ecosystem.
              It has 1710 star(s) with 218 fork(s). There are 64 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 2 open issues and 155 have been closed. On average issues are closed in 18 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of PEGTL is 3.2.7

            kandi-Quality Quality

              PEGTL has no bugs reported.

            kandi-Security Security

              PEGTL has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              PEGTL is licensed under the BSL-1.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              PEGTL releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PEGTL
            Get all kandi verified functions for this library.

            PEGTL Key Features

            No Key Features are available at this moment for PEGTL.

            PEGTL Examples and Code Snippets

            No Code Snippets are available at this moment for PEGTL.

            Community Discussions

            QUESTION

            env: node: No such file or directory
            Asked 2020-May-28 at 16:26

            env: node: No such file or directory

            I checked if my directory for node wasn't wrong and it's fine.

            I tried these following answers already: 1. https://github.com/nodejs/node-v0.x-archive/issues/3911 2. https://github.com/creationix/nvm/issues/1702 3. browserify error /usr/bin/env: node: No such file or directory

            ...

            ANSWER

            Answered 2018-Aug-15 at 09:30
            • Trynode -v to see whether you've installed node. I think your node not works.

            • nvm is the environment managment for node. If you are using nvm, you should brew install nvm, and use nvm install version-of-node-you-want-to-install to install node, and use nvm use the-version to let node works.

            • Whole install chain is:

              • brew install nvm, to install nvm, which is environment/version management for node.

              • nvm install 10.3.0, to install node and npm

              • npm install -g yarn, to install yarn

              • use node -v, npm -v, nvm -v, yarn -v to check if they all works.

            Source https://stackoverflow.com/questions/50652989

            QUESTION

            How can I include a header-only library with CMake?
            Asked 2019-May-12 at 01:35

            How can I add a header-only library outside the directory?

            Previously I was using add_subdirectory(HEADERLIBRARY) only when the directory HEADERLIBRARY was inside the project directory. However, now I want to use the library for multiple projects, so I made a directory like this:

            ...

            ANSWER

            Answered 2019-May-12 at 01:35

            Yes, you still just use add_subdirectory(source_dir [binary_dir] [EXCLUDE_FROM_ALL]). Because source_dir is not within the source directory tree of the top-level project you have to specify the [binary_dir] folder that is going to be used. By default binary_dir is the same as source_dir within the binary directory tree and it is handled automatically.

            Source https://stackoverflow.com/questions/56091505

            QUESTION

            How to define unicode ranges by properties/identifiers in c++ for PEGTL
            Asked 2019-Mar-05 at 15:25

            With PEGTL (https://github.com/taocpp/PEGTL), which is a template based C++11 header-only PEG library, I can define ranges for unicode characters like this:

            • utf8::range<0x0, 0x10FF> //All UTF8 Characters
            • utf8::range<0x41, 0x5A, 0x61, 0x7A> //UTF8 0x41-0x5A[A-Z] and 0x61-0x7A[a-z]

            Now with UTF8 there is this properties categorisation (https://en.wikipedia.org/wiki/Unicode_character_property#General_Category) with which I could do something like [:Lu:] or [:ID_Start:] and get a set/range of characters.

            Now, since I'm working with c++ templates, I need those ranges at compile time. In my opinion I have the following options:

            1. Discover that PEGTL has itself the possibility to look up [:ID_Start:] or [:Lu:]
            2. Find a c++ preprocessor library, that allows such queries at compile time
            3. Get an Application/Online Service, where I can perform those queries and get ranges (as shown above), which I can then paste in my code.

            This also represents the order of the solutions I prefer.

            ...

            ANSWER

            Answered 2018-Mar-22 at 18:24

            The PEGTL uses rules to match characters, not return sets of characters. If you'd like to match characters with certain Unicode character properties, you could create a custom rule and implement it with the help of some Unicode library, e.g. ICU. It provides methods to test codepoints for various properties, see this link.

            Here's a complete example program:

            Source https://stackoverflow.com/questions/48570874

            QUESTION

            Handle correcly state with pegtl grammar
            Asked 2019-Jan-09 at 11:26

            I'm very new to peg and pegtl, so probably I'm missing something. I have a grammar very similar to the following one:

            ...

            ANSWER

            Answered 2019-Jan-09 at 11:26

            I asked to pegtl library authors and they kindly give me the correct way: the best thing to do is make your parser construct a parse tree, which is easy to fix when it backtracks using simple push and pop operations.

            I developed the code below for who had similar doubts.

            • avoid backtracking in rules with attached actions:

            Source https://stackoverflow.com/questions/53865323

            QUESTION

            pegtl - how to skip spaces for the entire grammar
            Asked 2018-Nov-22 at 12:04

            I am trying to parse a very simple language with PEGTL. I think I have found the problem, but don't understand why; white spaces are not ignored. I understand it must be possible to not ignore white space so that indentation-aware languages can also be parsed. But I couldn't find a mechanism to "eat" white spaces by default. Given:

            ...

            ANSWER

            Answered 2018-Nov-22 at 12:04

            I don't think there is a shortcut, you have to specify the grammar in a way that makes it unambiguous where and how many whitespaces you allow.

            The best way to do it I think is to add a convenience rule template that allows matching a list (tao::pegtl::seq) of rules separated by any allowed separater (generally whitespace plus comments).

            Source https://stackoverflow.com/questions/53427551

            QUESTION

            Collect template parameters at compile time
            Asked 2018-Aug-16 at 22:41

            I have a class which takes many other classes as template arguments (for compile-time grammar generation with TAO PEGTL if it matters) and would like to know if there is a better and more extensible way to do this, than typing everything manually.

            Current Situation:

            ...

            ANSWER

            Answered 2018-Aug-16 at 12:10
            Registration of rules

            I recommend an explicit manual registration of all "rules" (Class1, ..., ClassN) in a single place of your codebase:

            Source https://stackoverflow.com/questions/51873120

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install PEGTL

            You can download it from GitHub.

            Support

            ChangelogDevelopment (requires C++17)Version 3.x (requires C++17)Version 2.x (requires C++11)Version 1.x (requires C++11)
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Parser Libraries

            marked

            by markedjs

            swc

            by swc-project

            es6tutorial

            by ruanyf

            PHP-Parser

            by nikic

            Try Top Libraries by taocpp

            json

            by taocppC++

            taopq

            by taocppC++

            config

            by taocppC++

            operators

            by taocppC++

            sequences

            by taocppC++