{"id":48892084,"url":"https://github.com/configuredthings/rdp.js","last_synced_at":"2026-04-19T09:02:45.185Z","repository":{"id":351636382,"uuid":"1211665571","full_name":"ConfiguredThings/RDP.js","owner":"ConfiguredThings","description":"Minimal TypeScript base class for building recursive descent parsers — with a CLI that generates typed parsers from EBNF or ABNF grammars","archived":false,"fork":false,"pushed_at":"2026-04-15T20:22:06.000Z","size":500,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-15T22:10:06.047Z","etag":null,"topics":["abnf","ebnf","grammar","parser","parser-generator","recursive-descent-parser","typescript"],"latest_commit_sha":null,"homepage":"https://configuredthings.github.io/RDP.js/","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/ConfiguredThings.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-15T16:13:19.000Z","updated_at":"2026-04-15T20:21:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ConfiguredThings/RDP.js","commit_stats":null,"previous_names":["configuredthings/rdp.js"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/ConfiguredThings/RDP.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConfiguredThings%2FRDP.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConfiguredThings%2FRDP.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConfiguredThings%2FRDP.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConfiguredThings%2FRDP.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConfiguredThings","download_url":"https://codeload.github.com/ConfiguredThings/RDP.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConfiguredThings%2FRDP.js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31878830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T07:36:03.521Z","status":"ssl_error","status_checked_at":"2026-04-16T07:35:53.576Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["abnf","ebnf","grammar","parser","parser-generator","recursive-descent-parser","typescript"],"created_at":"2026-04-16T09:00:21.181Z","updated_at":"2026-04-16T09:00:33.804Z","avatar_url":"https://github.com/ConfiguredThings.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RDP.js\n\n![projectmascot](recursquirrel.svg)\n\nA minimal, typed base class for writing recursive descent parsers in TypeScript — plus an optional grammar interpreter and a code generator (`rdp-gen`) that produces strictly-typed TypeScript parser classes from EBNF or ABNF grammars.\n\n## What is `@configuredthings/rdp.js`?\n\nA minimal, typed base class that handles buffer management and position tracking so subclasses can focus purely on grammar rules. TypeScript, dual ESM/CJS, zero runtime dependencies.\n\nKey components:\n- **`RDParser`** — base class; subclass and implement each production rule as a method\n- **`rdp-gen`** — CLI; reads an ISO 14977 EBNF or RFC 5234 ABNF grammar file and emits a strictly-typed TypeScript parser class and exported discriminated-union parse-tree types\n- **`GrammarInterpreter`** — runtime interpreter; execute grammars without a code-generation step\n- **`ObservableRDParser`** — opt-in parse tracing via an attached `ParseObserver`\n\n## LL(1) grammars and backtracking\n\n\u003e [!IMPORTANT]\n\u003e **`rdp-gen` generates parsers that assume LL(1) grammars.** Feeding it a non-LL(1) grammar will produce a parser that silently returns incorrect results, not a helpful error — with one exception: left recursion is detected at generation time and rejected.\n\n**What LL(1) means:** the parser scans left-to-right (first L), produces the leftmost derivation (second L), and needs only one byte of lookahead (the 1) to decide which production to apply at each step. Grammars where two alternatives share a common prefix, or where a rule is ambiguous, are not LL(1).\n\n**The base class is more general.** `RDParser` exposes `restorePosition`, which allows hand-written subclasses to implement backtracking and parse grammars beyond LL(1). `rdp-gen` does not emit backtracking code — that is a hand-crafting concern.\n\nLeft recursion can always be eliminated by rewriting the grammar to use iteration (`{...}` / `A, {A}`), which is what LL(1) grammars require.\n\n## Quick start — scaffold a new project\n\n```bash\nnpm install -g @configuredthings/rdp.js\nmkdir my-parser \u0026\u0026 cd my-parser\nrdp-gen init --name my-parser\nnpm install\n```\n\n## Manual setup\n\nInstall: `npm install @configuredthings/rdp.js`\n\nRequired `tsconfig.json` options:\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"strict\": true,\n    \"noUncheckedIndexedAccess\": true,\n    \"moduleResolution\": \"node16\"\n  }\n}\n```\n\n- `target: ES2022` — required for native `#` private fields\n- `strict: true` — the generated parser and its parse-tree types are verified to compile cleanly under this setting\n- `noUncheckedIndexedAccess: true` — all array accesses in the generated code are null-aware\n- `moduleResolution: node16` or `bundler` — required for the package exports map\n\n## Documentation\n\nFull documentation is at [configuredthings.github.io/RDP.js](https://configuredthings.github.io/RDP.js), including:\n\n- [Tutorial: arithmetic parser with rdp-gen](https://configuredthings.github.io/RDP.js/docs/tutorial/)\n- [Extending RDParser (hand-crafted parsers)](https://configuredthings.github.io/RDP.js/docs/extending/)\n- [Debugging with ObservableRDParser](https://configuredthings.github.io/RDP.js/docs/debugging/)\n- [CLI reference](https://configuredthings.github.io/RDP.js/docs/cli/)\n- [Bootstrapping](https://configuredthings.github.io/RDP.js/docs/bootstrapping/)\n- [API reference (TypeDoc)](https://configuredthings.github.io/RDP.js/api/)\n\n## Live playground\n\n[configuredthings.github.io/RDP.js](https://configuredthings.github.io/RDP.js)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfiguredthings%2Frdp.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconfiguredthings%2Frdp.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconfiguredthings%2Frdp.js/lists"}