{"id":13660792,"url":"https://github.com/darius/parson","last_synced_at":"2026-01-10T07:42:39.096Z","repository":{"id":5468834,"uuid":"6664734","full_name":"darius/parson","owner":"darius","description":"Yet another PEG parser combinator library and DSL","archived":false,"fork":false,"pushed_at":"2023-07-14T23:33:11.000Z","size":401,"stargazers_count":58,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-10T15:44:16.619Z","etag":null,"topics":["dsl","grammar","language","library","parsing","parsing-expression-grammar","parsing-library","peg"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"WGLab/UROBORUS","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darius.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2012-11-13T03:13:16.000Z","updated_at":"2024-07-17T09:38:36.000Z","dependencies_parsed_at":"2024-01-14T17:04:55.194Z","dependency_job_id":"c8435e17-e6c9-4a39-a3f1-921f8c8a4e76","html_url":"https://github.com/darius/parson","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/darius%2Fparson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fparson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fparson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darius%2Fparson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darius","download_url":"https://codeload.github.com/darius/parson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250727466,"owners_count":21477319,"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":["dsl","grammar","language","library","parsing","parsing-expression-grammar","parsing-library","peg"],"created_at":"2024-08-02T05:01:25.773Z","updated_at":"2026-01-10T07:42:39.038Z","avatar_url":"https://github.com/darius.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"parson\n======\n\nYet another PEG parser combinator library in Python. Selling points:\n\n  * The optional concrete syntax for grammars incorporates semantic\n    actions in a concise host-language-independent way. A Parson\n    grammar won't tie you to Python.\n\n  * Whole grammars can be analyzed and compiled, even if built at\n    runtime using combinators. (Contrast with a monadic library, where\n    this is uncomputable.)\n\n  * Semantic actions take and return values in a kind of point-free\n    style. \n\n  * You can use the concrete syntax with about as little ceremony as\n    `re.match`.\n\n  * You can parse non-string sequences.\n\nAnti-selling points:\n\n  * This library's in fluid design still, undocumented, utterly\n    untuned, etc. I'd like you to use it if you think you might give\n    feedback on the design; otherwise, no promises.\n\n  * Semantic actions work in a nontraditional way that may remind you\n    of Forth and which I haven't yet tried to make play well in typed\n    languages like Haskell. It's concise and just right for parsing,\n    but maybe in the end it'll turn out too cute and make me rip it\n    out if I want this to be used.\n\n  * I don't intend to make grammars work in other host languages\n    before the design settles. (I have done this a bit for the\n    [Peglet](https://github.com/darius/peglet) library, a more basic\n    and settled expression of the same approach to actions: it has\n    Python and JavaScript ports.)\n\nI guess the most similar library out there is LPEG, and that's way way\nmore polished.\n\n\nExamples\n========\n\nFor now, see all the eg_whatever.py files here. eg_calc.py,\neg_misc.py, eg_wc.py, and eg_regex.py have the smallest ones.\neg_trees.py shows parsing of tree structures, OMeta-style. Other\nexamples include programming languages and other somewhat-bigger\nstuff.\n\nBasic things still to explain:\n  * grammar syntax\n  * combinators\n  * recursion with combinators\n  * actions\n\nExamples of where I've used it for more than examples:\n  * [IDEAL](https://github.com/darius/unreal/blob/master/parser.py), a drawing language\n  * [Linogram](https://github.com/darius/goobergram/blob/master/parser.py), also a drawing language\n  * [Pythological](https://github.com/darius/pythological/blob/master/parser.py), a MiniKanren with a vaguely Prologish frontend\n  * [tinyhiss](https://github.com/darius/tinyhiss/blob/master/parser.py) -- Smalltalkish\n  * [Squee](https://github.com/darius/squee/blob/master/parse_sans_offsides.py), an experimental language not much like any others\n  * [Toot](https://github.com/darius/toot/blob/master/parse.py), a tutorial on writing a bytecode compiler\n\n\nNeeds more work:\n================\n\n  * There's a way to make a grammar automatically skip whitespace and\n    comments and such ('FNORD' rules), which probably should be done\n    differently.\n\n  * It should be made easy to use with a separate lexer, and I haven't\n    tried this enough to say it's ready (it's probably not).\n\n  * It should also be easy to write a 'real' compiler, where source-location\n    info gets added to all the AST nodes or whatever representation\n    you're building. This is doable but should be more automated.\n\nAfter these design issues, this ought to be ported to a\ndifferent-enough language to bring out issues of working nicely with\nmultiple languages.\n\nAfter *that*, I think it'd be time to tackle quality of implementation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarius%2Fparson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarius%2Fparson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarius%2Fparson/lists"}