{"id":16190158,"url":"https://github.com/luggage66/sprache-js","last_synced_at":"2025-09-11T13:43:36.433Z","repository":{"id":34871031,"uuid":"104021595","full_name":"luggage66/Sprache-js","owner":"luggage66","description":"A simple parser combinator with usable error messages.","archived":false,"fork":false,"pushed_at":"2023-11-30T21:04:36.000Z","size":1632,"stargazers_count":12,"open_issues_count":11,"forks_count":2,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-03-17T03:11:36.008Z","etag":null,"topics":["parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luggage66.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-09-19T03:25:49.000Z","updated_at":"2024-03-11T17:34:46.000Z","dependencies_parsed_at":"2024-10-27T19:36:41.819Z","dependency_job_id":"739937b7-325f-4a4e-9ca0-d9ced2fa880b","html_url":"https://github.com/luggage66/Sprache-js","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luggage66%2FSprache-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luggage66%2FSprache-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luggage66%2FSprache-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luggage66%2FSprache-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luggage66","download_url":"https://codeload.github.com/luggage66/Sprache-js/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244350913,"owners_count":20439290,"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"],"created_at":"2024-10-10T07:38:48.666Z","updated_at":"2025-03-19T03:30:54.408Z","avatar_url":"https://github.com/luggage66.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Sprache.js\n\nsprache.js is a TypeScript port of [Sprache](https://github.com/sprache/Sprache), a simple parser for C#\n\n[![\u003cSprache\u003e](https://circleci.com/gh/luggage66/Sprache-js.svg?style=shield)](\u003chttps://app.circleci.com/pipelines/github/luggage66/Sprache-js?branch=master\u003e)\n[![codecov](https://codecov.io/gh/luggage66/Sprache-js/branch/develop/graph/badge.svg?token=MHJDKKG47D)](https://codecov.io/gh/luggage66/Sprache-js)\n\n```sh\nnpm install sprache --save\n```\n\n## Usage\n\nUnlike most parser-building frameworks, you use Sprache from your program code, and don't need to set up any build-time code generation tasks.\n\nA simple parser might parse a sequence of characters:\n\n```js\nimport { Parse } from 'sprache';\n\n// Parse any number of capital 'A's in a row\nvar parseA = Parse.char('A').atLeastOnce();\n```\n\nSprache provides a number of built-in functions that can make bigger parsers from smaller ones, often callable via generators:\n\n```js\nimport { Parse } from 'sprache';\n\nconst identifier = Parse.query(function*() {\n    const leading  = yield Parse.whiteSpace.many();\n    const first    = yield Parse.letter.once();\n    const rest     = yield Parse.letterOrDigit.many();\n    const trailing = yield Parse.whiteSpace.many();\n\n    return Parse.return([first].concat(rest).join(''));\n});\n\nvar id = identifier.parse(\" abc123  \");\n\nAssert.isEqual(\"abc123\", id);\n```\n\n## More Examples\n\nMore examples are available in [src/examples/](https://github.com/luggage66/Sprache-js/tree/master/src/examples)\n\n## Building / Running examples\n\nRequirements:\n\n* NodeJS\n* yarn\n\n```sh\nwinget install OpenJS.NodeJS\nwinget install Yarn.Yarn\n```\n\n```sh\nyarn install\nyarn run build\nyarn run test\n```\n\nTo run as example\n\n```sh\nyarn run build \u0026\u0026 node dist/examples/sql\n```\n\nIs VSCode, just run task \"npm: install\", then F5 to run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluggage66%2Fsprache-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluggage66%2Fsprache-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluggage66%2Fsprache-js/lists"}