Skip to content

Commit cd67290

Browse files
committed
Updates
1 parent 4ff50dc commit cd67290

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

readme.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,59 +23,59 @@ $ npm install @sinclair/parsebox
2323

2424
## Example
2525

26-
ParseBox provides encoding of BNF notation in Static and Runtime environments.
26+
ParseBox provides combinators for parsing in Runtime and Static environments.
2727

28-
**BNF**
28+
<div style="display: flex; align-items: flex-start; gap: 2px;">
2929

30-
```bnf
31-
<T> ::= "X" "Y" "X"
32-
```
30+
<div style="flex: 1;">
3331

34-
**Type**
32+
### Runtime
3533

36-
```typescript
37-
const T = ["X", "Y", "Z"]
38-
```
34+
```typescript
35+
import { Runtime } from '@sinclair/parsebox'
3936

40-
**Static**
37+
const T = Runtime.Tuple([
38+
Runtime.Const('X'),
39+
Runtime.Const('Y'),
40+
Runtime.Const('Z')
41+
])
4142

42-
```typescript
43-
import { Static } from '@sinclair/parsebox'
43+
const R = Runtime.Parse(T, 'X Y Z W')
4444

45-
type T = Static.Tuple<[
46-
Static.Const<'X'>,
47-
Static.Const<'Y'>,
48-
Static.Const<'Z'>
49-
]>
45+
// const R = [['X', 'Y', 'Z'], ' W']
46+
```
5047

51-
type R = Static.Parse<T, 'X Y Z W'> // type R = [['X', 'Y', 'Z'], ' W']
52-
```
48+
</div>
5349

54-
**Runtime**
50+
<div style="flex: 1;">
5551

56-
```typescript
52+
### Static
5753

58-
import { Runtime } from '@sinclair/parsebox'
54+
```typescript
55+
import { Static } from '@sinclair/parsebox'
5956

60-
const T = Runtime.Tuple([
61-
Runtime.Const('X'),
62-
Runtime.Const('Y'),
63-
Runtime.Const('Z')
64-
])
57+
type T = Static.Tuple<[
58+
Static.Const<'X'>,
59+
Static.Const<'Y'>,
60+
Static.Const<'Z'>
61+
]>
6562

66-
const R = Runtime.Parse(T, 'X Y Z W') // const R = [['X', 'Y', 'Z'], ' W']
63+
type R = Static.Parse<T, 'X Y Z W'>
6764

68-
```
65+
// type R = [['X', 'Y', 'Z'], ' W']
66+
```
6967

70-
Which can be used to construct [Expression](https://www.typescriptlang.org/play/?moduleResolution=99&module=199#code/JYWwDg9gTgLgBAbzgZRgQxsAxnAvnAMyghDgHIABAZ2ADssAbNYKAejDSioFMAjCAB5kAUMNas4AWmkzZc+QsVLlKyWIkBRAWnANu6qaqPGTq0TACeYbnABK3KgFcG8ALwp0mLADoACpx4AHi0wKAAacgE4ACo4AAoLOABqOAAvAEoyAD44XNzxOEtrOwdnNzgAbQRhPNq6+obGpuaC3L0CGAAuOAAiAR6AbhrmkdGxuta4CGsoDGhunujB4fHVtYmJXKhgAHMACy7EFfWT8cna9sOei2XTu7HzvOnuWZh53qTb++-Gx63dg4LVJfH6gvKTXBDMHQuAFXARHo9AC6ogMpnRGNMBhCUAcNAgtDg-i4LzRmPJFPkojoMBeBDQWBsADlHCAXtgALJoMBgOg7ODcAS02gAEyoHgw2G8AEkuTy+UdchBHDAwCrujA9sAqBUyHQ1TAyEiBULuKLxQADAAkCDoBBeJScLhNwrFcForN4L1wFrgAH5HWU4N1aNwAG6k3DCIrM1nsnDuVCSnwskBeqCBVPxuW82g7LLmKw2ADyMzQorgic8UoAqrRgATAhUk14ZSKzTAIlntlgkQXRAUAEJ0TgWHN87r2EWORnikAYLB7bgiuAAFRepHLK5xcBpEDgvBHUESgtCeIbhNoEHb0aLcGHtFHU5n3ECABluB0XWa3Y5aABrK8AHdaAiWwAXgQVXXFP9AIgECKj7St4mGcD9kg01zUqO0HVLF45nCXdaHtKA7AgiIcNI+wqAw6C4Fg4DaEQlFagDJBLm6D8OgiZ5XnePC+MI7Z0O6B8n2XF9AjQg4wIcGAcijWpOM-GBhHSYQaTpBkbDE49xzzb8sJbKVZW5XN+WqJUVQNDUtR1PVaANI1DLdCpKLgLjOyIkiyPQlyYIAxjmOOANdIsZ9GXfFSwIggslPdcNIwMAAxBk3igfSdm6OUBWATUHR2YhHGsbcBFCKZSIErcNNoWkoHpRk4FSrB0sy-yJVbUz5QMyypms9V4jgY5NW1XV9RVZyoJ-cVdTiMgKOIh0cQiMhMmNAMd06Ya7LGxyJuNKasLcxbKrLUV1rgKqKy22pQwjKBhnUqMYyatLoGQ4yfDrC8m2GT7vFXYq9Cbf6AGECRowIyDmrIImWjqpXB2hIdW7I+zCP7qx8QGwGBiorpFdHhCRCJmtasy+X7F71ygEBV2YBgPqx7xvsbCpMeTAGgdfZtmaRlHomyUm3sImm6YZoncn+nG8bBiGYCh1ghdelroAiMX6eABhJYR7HuabIm+0LYocU1xmq051naF+qXmZlnm5eRhWyCSZWxbhsqoDNnXpf13nOf553JDdjcPdCb3YY51t7YNyOjdvYoxaZzmY4qMm1bXDdvYiMLMqpu8dwt6O-fduBTYlnOjzHCm837IA) or even [Type Syntax](https://www.typescriptlang.org/play/?moduleResolution=99&module=199#code/JYWwDg9gTgLgBAbzgBQIZQM4FM4F84BmUEIcA5AAIbAB2AxgDarBQD0MAnmFgEYQAerDBxoxU-MgChQkWIjgBlMTGB08hYqUrV6TFuy68BUyXQg0M8AGIQIcALwp02ABQADEBAAmAVwY4bOwRJSTg4Tm44ACEHULCUVQBrAB4AQQAacmAvMgA+OAAyODiwtFhgVAZkgHkQYBg0zLJsvNyQsIicVIdEErhsgC44SyhaAHM+mm8sDCHUgG0AXTjcENw3AEoQswt4GMdAgDoASXBoGBcyKLItyU7onqVUFTpkzogCaPz4n9-WVnChgejmCvzB4IhkPi-1+g2GMFGNDGAG4+lD0Ri4DD8EVQZj8VCYT8pl4ZgB+IZ4gnUv4AiFwkbjVE0lnQungkkzIaHHlLZmsllE+K4JZwAA+cB8NFJBFoWC8-IF1OxQA) parsers at runtime and inside the type system.
7168

72-
## Overview
69+
</div>
70+
71+
</div>
7372

74-
ParseBox is a parsing library designed to embed domain-specific languages (DSLs) within the TypeScript type system. It provides a set of type-level and runtime combinators that directly map to BNF notation. Once defined, these combinators can parse content either at runtime or statically within the type system.
7573

76-
ParseBox is designed to be general-purpose, offering foundational combinators for expressing BNF grammars both at runtime and statically within the type system. These combinators are symmetric, allowing runtime parsers to be easily ported to operate statically by mirroring their structures.
74+
## Overview
75+
76+
ParseBox is a parsing system designed for embedding domain-specific languages (DSLs) within the TypeScript type system. It provides a set of type-level and runtime combinators that directly map to BNF notation which can be used to parse content either at runtime or statically within the type system.
7777

78-
The project is written as parsing infrastructure for the [TypeBox](https://github.com/sinclairzx81/typebox) and [LinqBox](https://github.com/sinclairzx81/linqbox) projects, enabling these libraries to support advanced runtime parsing for their respective domains.
78+
ParseBox is written as parsing infrastructure for the [TypeBox](https://github.com/sinclairzx81/typebox) and [LinqBox](https://github.com/sinclairzx81/linqbox) projects, enabling these libraries to support advanced runtime parsing for their respective domains.
7979

8080
License MIT
8181

@@ -286,7 +286,7 @@ const E = Runtime.Parse(T, '01') // const E = []
286286

287287
### String
288288

289-
The String combinator will parse for quoted string literals. This combinator accepts an array of permissable quote characters. The result of this parser is the interior wrapped string.
289+
The String combinator will parse for quoted string literals. Thgit is combinator accepts an array of permissable quote characters. The result of this parser is the interior wrapped string.
290290

291291
```typescript
292292
const T = Runtime.String(['"'])

0 commit comments

Comments
 (0)