@kawaijs/parser 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @kawaijs/parser
|
|
2
|
+
|
|
3
|
+
**Indentation-aware Lexer, Parser, Compiler, and Diagnostic Engine for Kawa Script.**
|
|
4
|
+
|
|
5
|
+
Part of the [Kawaijs](https://github.com/biagio-scaglia/KawaiJS) visual novel engine.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @kawaijs/parser
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { compileScript } from '@kawaijs/parser';
|
|
17
|
+
|
|
18
|
+
const script = `
|
|
19
|
+
character yumia "Yumia"
|
|
20
|
+
|
|
21
|
+
label start:
|
|
22
|
+
scene bg classroom
|
|
23
|
+
yumia "Hello world!"
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const storyPackage = compileScript(script, 'main.kawa');
|
|
27
|
+
console.log(storyPackage);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Features
|
|
31
|
+
- **Indentation Lexer**: Clean Python/Ren'Py-style whitespace and block tracking.
|
|
32
|
+
- **Rich Diagnostics**: Formatted code frames with line numbers, caret underlines, and hint suggestions.
|
|
33
|
+
- **AST to IR Compiler**: Compiles high-level script into an execution instruction stream with label resolution.
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
MIT © Biagio Scaglia
|