{"id":13894245,"url":"https://github.com/axilmar/parserlib","last_synced_at":"2025-07-17T09:31:26.993Z","repository":{"id":2639356,"uuid":"3628415","full_name":"axilmar/parserlib","owner":"axilmar","description":"A c++17 recursive-descent generic parsing library that supports left recursion, tokenization, AST tree creation, multiple error handling etc..","archived":false,"fork":false,"pushed_at":"2024-11-24T11:36:53.000Z","size":9713,"stargazers_count":92,"open_issues_count":0,"forks_count":19,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-11-24T12:27:11.570Z","etag":null,"topics":["cpp17","parser","parser-library"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axilmar.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.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":"2012-03-05T15:35:08.000Z","updated_at":"2024-11-24T11:36:57.000Z","dependencies_parsed_at":"2024-02-22T14:47:41.042Z","dependency_job_id":"d8061d6e-7e6a-486e-9f9f-70fa86bd0cad","html_url":"https://github.com/axilmar/parserlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axilmar%2Fparserlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axilmar%2Fparserlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axilmar%2Fparserlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axilmar%2Fparserlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axilmar","download_url":"https://codeload.github.com/axilmar/parserlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226248219,"owners_count":17595158,"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":["cpp17","parser","parser-library"],"created_at":"2024-08-06T18:01:27.372Z","updated_at":"2025-07-17T09:31:26.987Z","avatar_url":"https://github.com/axilmar.png","language":"C++","readme":"# Parserlib\r\n\r\nA `c++17` recursive-descent parser library with the following features:\r\n\r\n- ENBF-like syntax for writing grammar expressions.\r\n- character, string, boolean, set, range terminals.\r\n- recursive and left-recursive grammars.\r\n- custom parsing functions, callbacks and nodes.\r\n- multiple errors per parse.\r\n- case sensitive/insensitive parsing.\r\n- optional line/column counting.\r\n- parsing utf-8 strings.\r\n- translation of source to AST nodes.\r\n- loading a file directly into memory.\r\n- parsing streams.\r\n- lexing/parsing.\r\n\r\nVersion 1.0.0.8\r\n\r\n## Quick Example\r\n\r\n```cpp\r\n#include \"parserlib.hpp\"\r\nusing namespace parserlib;\r\n\r\nint main() {\r\n    const auto grammar = terminal(\"parserlib is\") \u003e\u003e \" my favorite library\" \u003e\u003e -terminal('!');\r\n    std::string source = \"parserlib is my favorite library!\";\r\n    parse_context\u003cstd::string\u003e pc(source);\r\n    bool success = grammar.parse(pc);\r\n}\r\n```\r\n\r\n##### Table Of Contents\r\n\r\n1. [EBNF-like syntax](doc/ebnf_like_syntax.md)\r\n1. [Terminals](doc/terminals.md)\r\n1. [Recursive Grammars](doc/recursion.md)\r\n1. [The Parse Context](doc/parse_context.md)\r\n1. [Custom Parse Functions/Callbacks/Parse Nodes](doc/custom_functions.md)\r\n1. [Error Handling](doc/error_handling.md)\r\n1. [Line/Column counting](doc/line_counting.md)\r\n1. [UTF-8 strings](doc/utf8_strings.md)\r\n1. [AST Nodes](doc/ast_nodes.md)\r\n1. [Lexing And Parsing](doc/lexing_parsing.md)\r\n1. [Parsing In-Memory Sources](doc/load_file.md)\r\n1. [Parsing Sources From Streams](doc/parsing_streams.md)\r\n1. [Versions](#versions)\r\n\r\n### Versions\r\n\r\n  - 1.0.0.8\r\n  \t- Rewritten again from scratch, in order to deal with error handling in a much better way,\r\n  \t  to make everything `noexcept` for increased performance,\r\n      to add new capabilities.\r\n\r\n  - 1.0.0.7\r\n    - Rewritten from scratch, to improve quality of the API.\r\n\r\n  - 1.0.0.6\r\n  \t- Added function-based parsing.\r\n\r\n  - 1.0.0.5\r\n  \t- Added custom match functions in order to allow the resolution of ambiguities while parsing.\r\n  \t- allowed terminal values to be of different type that the value of the source container, in order to allow the result of a parse (the ast nodes created by a parse) to be fed to another parse function.\r\n  \t- added terminal parsing via functions.\r\n  \t- added parsing via standalone functions.\r\n  \t- added multiple error handling.\r\n\r\n  - 1.0.0.4\r\n  \r\n    - Rewrote the library:\r\n        - all parser grammar classes are now inside a single template class `class parser_engine\u003cSourceT, MatchIdT\u003e`, for the following reasons:\r\n            - compiler performance (MSVC 32-bit regularly crashed with out of memory error from the many template instantiations of previous versions).\r\n            - library code organization; writing a grammar usually requires including all the grammar constructs, so it is reduntant to have separate files for each grammar-related class.\r\n            - user code organization; whole grammars need to be specialized on source type.\r\n        - coding style is closer to the standard: all identifiers are lower case, words are separated by underscores, idiomatic c++ is used whenever possible.\r\n    - Rewrote the documentation, due to more functionality to be added in the future.\r\n \r\n \r\n  - 1.0.0.3\r\n \r\n \t- Reorganized the library in order to support compiler front ends into a separate namespace. The main library is now in `namespace parserlib::core`.\r\n \t- Added `namespace parserlib::cfe` which now contains the compiler-front-end functionality.\r\n \t- separated tokenization and parsing phases for compiler-front-ends.\r\n \t- Added relevant documentation and unit tests.\r\n \r\n\r\n  - 1.0.0.2\r\n \r\n \t- Rewrote the library from scratch in order to provide a better interface. Changes:\r\n \t\r\n        - All the getter methods now start with 'get', in order to play better with Intellisense.\r\n        - The `ParseContext` class is now configured over the Source type, with the default class being the class `SourceString`.\r\n        - The class `SourceString` provides custom iterator which counts lines and columns, compatible with the `std::string` interface.\r\n        - The functions `terminal`, `terminalSet`, `terminalRange` are changed to `term`, `oneOf`, `oneIn`.\r\n        - Matches are now only hierarchical (as in `operator \u003e=` of previous version).\r\n        - The `'operator \u003e=` has been replaced with `operator -\u003e*`, which is much more distinct than the former; no more typing accidentally '\u003e\u003e' where `\u003e=` was intended.\r\n        - The default match id type is no longer a string; it is an int.\r\n        - Simplified the left recursion parsing implementation.\r\n \r\n  - 1.0.0.1\r\n \r\n  \t- Added support for compiler front-end construction.\r\n  \t\r\n- 1.0.0.0\r\n \r\n  \t- Initial release.\r\n\r\n### TODO\r\n\r\nTODO list in the current version:\r\n\r\n - review and improve the library documentation.\r\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxilmar%2Fparserlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxilmar%2Fparserlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxilmar%2Fparserlib/lists"}