{"id":22317562,"url":"https://github.com/neshkeev/pgpc","last_synced_at":"2025-06-16T07:33:56.850Z","repository":{"id":183106281,"uuid":"669478616","full_name":"neshkeev/pgpc","owner":"neshkeev","description":"Python Generators based Parser Combinators","archived":false,"fork":false,"pushed_at":"2023-07-24T02:56:45.000Z","size":18,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T08:04:59.842Z","etag":null,"topics":["parser","parser-combinators","python","text-processing"],"latest_commit_sha":null,"homepage":"","language":"Python","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/neshkeev.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":"2023-07-22T12:11:30.000Z","updated_at":"2025-05-20T15:03:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6b32ed0-b2b3-4e7a-aaac-4f4106982cac","html_url":"https://github.com/neshkeev/pgpc","commit_stats":null,"previous_names":["neshkeev/pgpc"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/neshkeev/pgpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neshkeev%2Fpgpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neshkeev%2Fpgpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neshkeev%2Fpgpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neshkeev%2Fpgpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neshkeev","download_url":"https://codeload.github.com/neshkeev/pgpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neshkeev%2Fpgpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260119454,"owners_count":22961526,"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":["parser","parser-combinators","python","text-processing"],"created_at":"2024-12-03T23:10:11.867Z","updated_at":"2025-06-16T07:33:56.834Z","avatar_url":"https://github.com/neshkeev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PGPC\n\n## Overview\n\n**PGPC** is a parser combinator library. Its name is an acronym, which stands for **P**ython **G**enerator based **P**arser **C**ombinator library.\n\nThe library was heavily influenced by the [Parsec](https://github.com/haskell/parsec) monadic parser combinator library,\nso the transition from `Parsec` (and other parser combinators) to `PGPC` should be relatively easy.\n\nThe original idea of the library is emulating the `do`-notation with the `yield` Python keyword.\n\n## Quick start\n\nThe `@topology` decorator over a function allows the `yield` keyword work with parsers in a `do`-notation-like fashion:\n\n1. install the package: `pip install pgpc`\n1. save the following code into `main.py`:\n```python\nfrom pgpc.scanner import TextScanner\nfrom pgpc.parser import Parser, topology, char, position, content\n\n\n@topology\ndef parse_hello_world():\n    start = yield position()\n\n    for c in \"Hello\":\n        yield char(c)\n\n    yield char(\",\")\n    yield char(\" \")\n\n    for c in \"World\":\n        yield char(c)\n\n    yield char(\"!\")\n\n    end = yield position()\n    source = yield content()\n\n    return f\"Parsed '{source[start.offset:end.offset]}' which started at {start} and ended at {end}\"\n\n\nif __name__ == '__main__':\n    text = \"Hello, World!\"\n\n    hw_parser: Parser[str] = parse_hello_world()\n\n    result = hw_parser(TextScanner(text))\n\n    print(result)\n```\n3. run `main.py`: `python main.py`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneshkeev%2Fpgpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneshkeev%2Fpgpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneshkeev%2Fpgpc/lists"}