Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcluck90/parsnip-ts
Parser combinators built in, and for, TypeScript
https://github.com/mcluck90/parsnip-ts
parser-combinators parsing typescript
Last synced: 4 days ago
JSON representation
Parser combinators built in, and for, TypeScript
- Host: GitHub
- URL: https://github.com/mcluck90/parsnip-ts
- Owner: MCluck90
- License: mit
- Created: 2020-11-16T17:30:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-18T10:20:19.000Z (about 2 years ago)
- Last Synced: 2024-08-08T16:55:41.417Z (7 months ago)
- Topics: parser-combinators, parsing, typescript
- Language: TypeScript
- Homepage: http://mcluck.tech/parsnip-ts/
- Size: 218 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🌱 Parsnip-ts
Parser combinators written in and for TypeScript.
## Getting Started
### Installation
```sh
npm install parsnip-ts
```### Example
```ts
import { list, text } from 'parsnip-ts'
import { integer } from 'parsnip-ts/numbers'
import { ws } from 'parsnip-ts/whitespace'const array = text('[')
.and(list(integer, ws.and(text(',').and(ws)))
.bind(integers =>
text(']').map(() => integers)
)array.parseToEnd('[1, 2, 3]') // [1, 2, 3]
```For a more thorough example, check out the [examples folder.](https://github.com/MCluck90/parsnip-ts/tree/main/examples)