{"id":20475612,"url":"https://github.com/publius-fabius/pgenc","last_synced_at":"2026-06-05T17:32:06.291Z","repository":{"id":255908615,"uuid":"853097557","full_name":"Publius-Fabius/pgenc","owner":"Publius-Fabius","description":"PGENC - Parser Generator for C","archived":false,"fork":false,"pushed_at":"2024-11-09T04:13:34.000Z","size":117,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T03:16:09.517Z","etag":null,"topics":["c","optimized","parser-combinators","parser-generator","parsers","static-library"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Publius-Fabius.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-06T01:43:56.000Z","updated_at":"2024-11-09T04:13:38.000Z","dependencies_parsed_at":"2025-01-16T03:25:06.581Z","dependency_job_id":null,"html_url":"https://github.com/Publius-Fabius/pgenc","commit_stats":null,"previous_names":["publius-fabius/pgenc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Publius-Fabius%2Fpgenc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Publius-Fabius%2Fpgenc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Publius-Fabius%2Fpgenc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Publius-Fabius%2Fpgenc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Publius-Fabius","download_url":"https://codeload.github.com/Publius-Fabius/pgenc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242042351,"owners_count":20062391,"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":["c","optimized","parser-combinators","parser-generator","parsers","static-library"],"created_at":"2024-11-15T15:16:35.980Z","updated_at":"2025-03-05T14:27:32.977Z","avatar_url":"https://github.com/Publius-Fabius.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgenc - Parser Generator for C\n\nThis project provides a robust option for generating highly optimized static \nparsers in standard C99.  Parsers are defined as a grammar in a language \ninspired by EBNF, but with several powerful extensions.  Grammar files can \nbe used to generate text parsers in C.  PGENC is fully self parsing and comes \nwith its own definition defined in its own language (see grammar/self.g).\n\nClone PGENC:\n```\n    git clone https://github.com/Publius-Fabius/selc.git\n    git clone https://github.com/Publius-Fabius/pgenc.git\n    cd pgenc\n    make bin/pgenc\n```\n\nIn a file named input.grammar:\n```\n    let dog = 'd' 'o' 'g';\n    let cat = 'c' 'a' 't';\n    let animal = dog | cat;\n```\n\nGenerate the parsers:\n```\n    bin/pgenc -g input.grammar -s my_parsers.c -d my_parsers\n```\n\nUse the parsers in your code like so:\n```\n    #include \"pgenc/parser.h\"\n\n    extern const struct pgc_par my_parsers_dog;\n    extern const struct pgc_par my_parsers_cat;\n    extern const struct pgc_par my_parsers_animal;\n```\n\nCompile in the standard manner:\n```\n    gcc -o my_program my_code.c my_parsers.c\n```\n\nHere's an example of some code generated to parse PGENC itself.\n```\nstatic const struct pgc_cset p0_p = { .words = { 0x3e00 , 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }; \nconst struct pgc_par pgc_self_wsc = PGC_PAR_SET(\u0026p0_p); \nconst struct pgc_par pgc_self_ws = PGC_PAR_REP(\u0026pgc_self_wsc, 0, 512); \nstatic const struct pgc_cset p1_p = { .words = { 0x0 , 0x0, 0x7fffffe, 0x7fffffe, 0x0, 0x0, 0x0, 0x0 } }; \nconst struct pgc_par pgc_self_alpha = PGC_PAR_SET(\u0026p1_p); \nstatic const struct pgc_cset p2_p = { .words = { 0x0 , 0x3ff0000, 0x87fffffe, 0x7fffffe, 0x0, 0x0, 0x0, 0x0 } }; \nconst struct pgc_par pgc_self_idc = PGC_PAR_SET(\u0026p2_p); \nstatic const struct pgc_par p3_p = PGC_PAR_REP(\u0026pgc_self_idc, 0, 256); \nconst struct pgc_par pgc_self_idpat = PGC_PAR_AND(\u0026pgc_self_alpha, \u0026p3_p); \nconst struct pgc_par pgc_self_id = PGC_PAR_CALL(pgc_lang_capid, \u0026pgc_self_idpat); \nstatic const struct pgc_cset p4_p = { .words = { 0x0 , 0x3ff0000, 0x7e, 0x7e, 0x0, 0x0, 0x0, 0x0 } }; \nconst struct pgc_par pgc_self_xdigit = PGC_PAR_SET(\u0026p4_p); \nconst struct pgc_par pgc_self_xdigits = PGC_PAR_REP(\u0026pgc_self_xdigit, 1, 2); \n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpublius-fabius%2Fpgenc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpublius-fabius%2Fpgenc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpublius-fabius%2Fpgenc/lists"}