{"id":19863653,"url":"https://github.com/sandialabs/parsegen-cpp","last_synced_at":"2025-10-21T06:35:35.507Z","repository":{"id":64512045,"uuid":"321451226","full_name":"sandialabs/parsegen-cpp","owner":"sandialabs","description":"A C++17 library for parser generation for LALR(1) languages","archived":false,"fork":false,"pushed_at":"2023-01-09T23:29:37.000Z","size":204,"stargazers_count":13,"open_issues_count":2,"forks_count":2,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-06T22:38:47.979Z","etag":null,"topics":["cmake","context-free-grammar","cpp","cpp17","lalr-parser-generator","parse","parser","parser-generator","parser-library","regular-expression","sandia-national-laboratories","scr-2564","snl-comp-science-libs"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandialabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-14T19:26:51.000Z","updated_at":"2024-11-05T11:47:21.000Z","dependencies_parsed_at":"2023-01-13T14:54:51.334Z","dependency_job_id":null,"html_url":"https://github.com/sandialabs/parsegen-cpp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fparsegen-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fparsegen-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fparsegen-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2Fparsegen-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandialabs","download_url":"https://codeload.github.com/sandialabs/parsegen-cpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251986802,"owners_count":21675951,"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":["cmake","context-free-grammar","cpp","cpp17","lalr-parser-generator","parse","parser","parser-generator","parser-library","regular-expression","sandia-national-laboratories","scr-2564","snl-comp-science-libs"],"created_at":"2024-11-12T15:15:38.267Z","updated_at":"2025-10-21T06:35:35.411Z","avatar_url":"https://github.com/sandialabs.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"ParseGen\n========\n\nParseGen is a C++17 library for working with ASCII text formats.\nFor example, it can parse subsets of formats like XML and YAML.\nParseGen's utility is that it is a toolbox for defining new\ntext languages and parsing them.\n\nA presentation on ParseGen can be downloaded [here](https://figshare.com/articles/presentation/Parsing_Input_Files_With_ParseGen/16624408)\n\nTheory\n------\n\nParseGen is based on classical language theory including\nregular languages, regular expressions, finite automata,\ncontext-free grammars, and LALR(1) parsing.\nTokens are described by regular expressions and\nlanguages are expressed as context-free grammars.\nParseGen use finite automaton theory to build table-based\nlexers, and uses a fast algorithm from scientific\nliterature to build a table-based shift-reduce parser\nfor a context-free grammar.\n\nWhile we acknowledge that many text formats today are not\nbased cleanly on context-free language theory, we\nbelieve there is a niche to be filled by a library\nlike ParseGen that is still based on classical theory.\n\nImplementation\n--------------\n\nThe key contribution of ParseGen to the software community\nis to implement these parser generators are pure C++\nobjects and functions, as opposed to tools like Flex and Bison\nwhich have custom input formats describing languages and\noutput generated source code that must then be re-compiled\nto obtain a parser.\nA language can be built at runtime as a C++ object in ParseGen\nand then a parser object can be constructed for that language\nand executed repeatedly to parse C++ streams.\nThis offers maximum flexibility in the workflows users\ncan employ.\n\nFrequently Asked Questions\n--------------------------\n1. How do I build it?\n\nParseGen uses the CMake build system and\ntries to be a \"standard modern CMake package\" as much as possible.\n\n2. Where do I start with the API?\n\nThe two most important classes\nin ParseGen are the `language`, which fully describes a text language,\nand the `parser`, which parses a language according to user-defined\nrules that react to syntactic constructs observed.\nThe file `src/parsegen_calc.cpp` is a great introductory example\nthat builds a command-line calculator app using ParseGen.\n\n3. Why C++?\n\nC++ is the language of choice in the HPC community\nthat originated this code.\n\n4. Why C++17?\n\nWe use the `std::any` feature of C++17 to allow\nusers to return any object as the result of parsing some text.\n\n5. Why ASCII only, why not Unicode?\n\nSo far avoiding Unicode support has allowed a simple design\nand none of the formats we target really need Unicode.\nHowever, we welcome any contributions that move us towards\nUnicode support.\n\nAt Sandia, ParseGen is SCR# 2564.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Fparsegen-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandialabs%2Fparsegen-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Fparsegen-cpp/lists"}