{"id":22740674,"url":"https://github.com/gabrielhdt/pratter","last_synced_at":"2025-04-14T05:53:19.262Z","repository":{"id":38613901,"uuid":"327094688","full_name":"gabrielhdt/pratter","owner":"gabrielhdt","description":"Mirror of \u003chttps://forge.tedomum.net/koizel/pratter\u003e","archived":false,"fork":false,"pushed_at":"2024-10-08T08:23:41.000Z","size":159,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T05:53:14.156Z","etag":null,"topics":["parser","pratt-parser"],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielhdt.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-01-05T19:10:59.000Z","updated_at":"2024-11-04T23:56:47.000Z","dependencies_parsed_at":"2022-09-13T09:21:38.746Z","dependency_job_id":null,"html_url":"https://github.com/gabrielhdt/pratter","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielhdt%2Fpratter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielhdt%2Fpratter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielhdt%2Fpratter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielhdt%2Fpratter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielhdt","download_url":"https://codeload.github.com/gabrielhdt/pratter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248830389,"owners_count":21168272,"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","pratt-parser"],"created_at":"2024-12-10T23:10:15.873Z","updated_at":"2025-04-14T05:53:19.235Z","avatar_url":"https://github.com/gabrielhdt.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Pratter](https://forge.tedomum.net/koizel/pratter)\n\nBy Gabriel Hondet\n\nPratter allows to transform strings of symbols and mixfix operators to full\nbinary trees.\nPratter is convenient for parsing languages made of terms with many mixfix\noperators with different associativities and precedences such as\narithmetic or λ-calculi.\nIn contrast to parser generators, parsing rules can be edited dynamically.\n\nYou are free to copy, modify and distribute Pratter with attribution under the\nterms of the BSD 3 Clause license. See the [license](./LICENSE) for more details.\n\n## Getting started\n\nTo compile and use pratter, you need\n\n- ocaml \u003e= 4.14\n- dune \u003e= 2.7\n\nThen, at the root of the source tree,\n```command\n$ make install\n```\n\nTo ensure it's working write the following code in some file `plus.ml`\n```ocaml\ntype t = A of t * t | S of string\nlet appl t u = A (t, u)\nlet token = Fun.id\nlet ops =\n  Pratter.Operators.(infix (function S \"+\" as s -\u003e Some s | _ -\u003e None) Left 0.3)\nlet parse = Pratter.expression ~token ~appl ~ops\nlet () =\n  let input = List.to_seq [ S \"x\"; S \"+\"; S \"y\"] in\n  assert (Result.is_ok @@ Pratter.run parse input)\n```\nthen compile it using `$ ocamlfind ocamlc -package pratter -linkpkg plus.ml`.\nExecuting `$ ./a.out` should return 0.\n\nThe aforementioned code defines a parser for the language made of strings\ninterspersed with infix `+` operators\n\n## What next?\n\n- There's a [change log](./CHANGELOG.md).\n- There's a [license](./LICENSE).\n- [This file](./t/simple.ml) is another use case example that is slightly more\n  involved than the one in this readme.\n\nYou can raise issues either using the [issue\ntracker](https://forge.tedomum.net/koizel/pratter/issues)\nor sending an email to `\u003ckoizel#pratter@aleeas.com\u003e`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielhdt%2Fpratter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielhdt%2Fpratter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielhdt%2Fpratter/lists"}