A Parsing Expression Grammar (PEG) generator for the D programming language, enabling compile-time and runtime parsing.
Pegged is a parsing expression grammar (PEG) generator for the D programming language. It allows developers to define grammars using a standard PEG syntax and automatically generates parsers that can execute at compile time or runtime. This solves the problem of implementing custom parsers for domain-specific languages, data formats, or code transformation tasks directly within D code.
D developers who need to implement parsers for custom languages, data formats, or tools requiring compile-time code analysis and generation. It's particularly useful for those working on compilers, interpreters, or text processing utilities.
Developers choose Pegged because it provides a clean, readable PEG-based DSL integrated into D, with unique support for both compile-time and runtime parsing, left recursion, and advanced features like parametrized rules and semantic actions, all without external dependencies.
A Parsing Expression Grammar (PEG) module, using the D programming language.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a standard, readable domain-specific language based on Bryan Ford's PEG notation, making grammar definitions intuitive and closely matching academic references, as emphasized in the philosophy.
Can parse at both compile time and runtime, enabling powerful code generation and dynamic parsing within the same framework, demonstrated in the usage examples with enum and auto parse trees.
Fully supports left-recursive grammars during runtime parsing, a feature many PEG parsers lack, allowing for more natural expression of grammars without manual transformations.
Includes utility grammars for common formats like JSON, C, XML, and CSV, saving development time and providing reference implementations, as listed in the Key Features.
Exclusively implemented in D and reliant on its metaprogramming features, it cannot be used in projects based on other languages, severely limiting adoption in polyglot environments.
The compile-time parsing feature can significantly increase compilation times, especially for complex grammars, as noted in the development process where parser regeneration is required and may slow builds.
Relies heavily on D's mixins and expression templates, which can lead to cryptic error messages and a steep learning curve for developers unfamiliar with advanced D features, as hinted in the 'Behind the Curtain' wiki.