{"id":18005450,"url":"https://github.com/anuragsoni/angstrom-examples","last_synced_at":"2025-03-26T10:32:06.738Z","repository":{"id":93535136,"uuid":"164183356","full_name":"anuragsoni/angstrom-examples","owner":"anuragsoni","description":"Sample parsers using Angstrom","archived":false,"fork":false,"pushed_at":"2019-04-28T02:24:41.000Z","size":8,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T14:52:43.218Z","etag":null,"topics":["angstrom","bencode","color","ocaml","parser"],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anuragsoni.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-05T04:59:02.000Z","updated_at":"2021-11-17T14:35:19.000Z","dependencies_parsed_at":"2023-04-29T17:19:14.376Z","dependency_job_id":null,"html_url":"https://github.com/anuragsoni/angstrom-examples","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/anuragsoni%2Fangstrom-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragsoni%2Fangstrom-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragsoni%2Fangstrom-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anuragsoni%2Fangstrom-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anuragsoni","download_url":"https://codeload.github.com/anuragsoni/angstrom-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245637077,"owners_count":20648090,"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":["angstrom","bencode","color","ocaml","parser"],"created_at":"2024-10-30T00:19:48.805Z","updated_at":"2025-03-26T10:32:06.731Z","avatar_url":"https://github.com/anuragsoni.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angstrom Examples\n\nExamples of parsers written using [Angstrom](https://github.com/inhabitedtype/angstrom).\n\n## Build\n1. Install `angstrom` (`opam install angstrom`)\n2. `dune build`\n\n## Explore via repl\n1. `dune utop src`\n\n## Example list\n\n1. Hex color parser. [Link](https://github.com/anuragsoni/angstrom-examples/blob/master/src/colors.ml).\n2. Bencode (`.torrent` file format) parser. [Link](https://github.com/anuragsoni/angstrom-examples/blob/master/src/bencode.ml).\n   We use the following type for representing bencode:\n    ```ocaml\n    type t =\n      | Integer of int\n      | String of string\n      | List of t list\n      | Dict of (string * t) list\n    ```\n    `List` and `Dict` contain values that are themselves bencode values, so we need\n    a parser that will accept bencode list and dictionary but we don't yet have access\n    to a parser for bencode values as a whole. We get around the issue by using `fix` from\n    `Angstrom`. We define our parsers for `List` and `Dict` within the function passed to `fix`,\n    which gives us access to a parser we can use to parse bencode values as a whole.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuragsoni%2Fangstrom-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanuragsoni%2Fangstrom-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanuragsoni%2Fangstrom-examples/lists"}