Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ikasoba/daizu.ts
daizu.ts is simple parser combinator.
https://github.com/ikasoba/daizu.ts
Last synced: 6 days ago
JSON representation
daizu.ts is simple parser combinator.
- Host: GitHub
- URL: https://github.com/ikasoba/daizu.ts
- Owner: ikasoba
- Created: 2023-07-24T13:00:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-26T15:04:54.000Z (11 months ago)
- Last Synced: 2024-11-24T17:21:00.372Z (about 1 month ago)
- Language: TypeScript
- Size: 72.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
٩(๑òωó๑)۶
@ikasoba000/daizu
daizu is simple parser combinator library.# installation
```
pnpm i @ikasoba000/daizu
```# Hello, world!
```ts
import * as D from "@ikasoba000/daizu";const parser = D.string("Hello, world!");
D.parse(parser, "Hello, world!"); // "Hello, world!"
const parser = D.regexp(/Hello, \w+!/);
D.parse(parser, "Hello, daizu!"); // "Hello, daizu!"
const parser = D.regexp(/Hello, (\w+)!/);
D.parse(parser, "Hello, daizu!"); // "daizu"
```# daizu/helper
```ts
import D from "@ikasoba000/daizu/helper";D.string("a").many1(); // Matches aaaaaaaaaaaaaa...
const parser =
D.choice(
D.regexp(/[a-zA-Z]/).map(x => x.toLowerCase()),
D.regexp(/\s*/).ignore()
)
.many0();parser.parse("a b \n c d e\n f") // "a", "b", "c", "d", "e", "f"
```