@holoscript/parser 1.0.0
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/LICENSE +21 -0
- package/README.md +44 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +54 -0
- package/src/index.ts +13 -0
- package/tsconfig.json +5 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 HoloScript Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @holoscript/parser
|
|
2
|
+
|
|
3
|
+
> HoloScript parser — tree-sitter grammars, tokenizer, AST types. Rust/WASM candidate.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Standalone parser package providing tree-sitter grammars and a performant tokenizer for HoloScript's three file formats (`.holo`, `.hs`, `.hsplus`). Designed as a Rust/WASM compilation candidate for use in browsers and editors.
|
|
8
|
+
|
|
9
|
+
## Key Components
|
|
10
|
+
|
|
11
|
+
| Component | Purpose |
|
|
12
|
+
|-----------|---------|
|
|
13
|
+
| **Tokenizer** | Lexical analysis for all HoloScript formats |
|
|
14
|
+
| **Tree-sitter grammar** | Incremental parsing for editor integration |
|
|
15
|
+
| **AST Types** | TypeScript type definitions for the AST |
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { tokenize, parse } from '@holoscript/parser';
|
|
21
|
+
|
|
22
|
+
// Tokenize source
|
|
23
|
+
const tokens = tokenize(source);
|
|
24
|
+
|
|
25
|
+
// Parse to AST
|
|
26
|
+
const ast = parse(source, { format: 'holo' });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Grammar
|
|
30
|
+
|
|
31
|
+
The tree-sitter grammar is defined in `grammar.js` and supports:
|
|
32
|
+
- `.holo` compositions (objects, environments, spatial groups)
|
|
33
|
+
- `.hs` templates (agents, streams, events)
|
|
34
|
+
- `.hsplus` modules (TypeScript-like types, imports, exports)
|
|
35
|
+
|
|
36
|
+
## Related
|
|
37
|
+
|
|
38
|
+
- [`@holoscript/core`](../core/) — Full parser implementations
|
|
39
|
+
- [`@holoscript/tree-sitter-holoscript`](../tree-sitter-holoscript/) — Tree-sitter bindings
|
|
40
|
+
- [Parser Internals](../../docs/architecture/PARSER_INTERNALS.md) — Architecture doc
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@holoscript/core/parser';
|
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@holoscript/parser",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "HoloScript parser — tree-sitter grammars, tokenizer, AST types. Rust/WASM candidate.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/brianonbased-dev/HoloScript.git",
|
|
18
|
+
"directory": "packages/parser"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@holoscript/core": "5.1.1"
|
|
22
|
+
},
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"tree-sitter": "0.21.1",
|
|
25
|
+
"tree-sitter-go": "^0.25.0",
|
|
26
|
+
"tree-sitter-javascript": "^0.25.0",
|
|
27
|
+
"tree-sitter-python": "^0.25.0",
|
|
28
|
+
"tree-sitter-rust": "^0.24.0",
|
|
29
|
+
"tree-sitter-typescript": "^0.23.2",
|
|
30
|
+
"web-tree-sitter": "^0.24.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"tsup": "^8.0.1",
|
|
34
|
+
"typescript": "~5.9.3",
|
|
35
|
+
"vitest": "^4.1.0"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/brianonbased-dev/HoloScript#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/brianonbased-dev/HoloScript/issues"
|
|
40
|
+
},
|
|
41
|
+
"author": "Brian X Base Team",
|
|
42
|
+
"keywords": [
|
|
43
|
+
"holoscript",
|
|
44
|
+
"xr",
|
|
45
|
+
"webxr",
|
|
46
|
+
"vr",
|
|
47
|
+
"ar",
|
|
48
|
+
"spatial-computing"
|
|
49
|
+
],
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
52
|
+
"test": "vitest run"
|
|
53
|
+
}
|
|
54
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @holoscript/parser — Parser & AST
|
|
3
|
+
*
|
|
4
|
+
* Re-exports parser subsystem from @holoscript/core.
|
|
5
|
+
* 58 files, 25K LOC. Candidate for Rust/WASM port.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { parse, tokenize, HoloScriptAST } from '@holoscript/parser';
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Re-export parser from core subpath
|
|
12
|
+
// Phase 2: parser source files will be moved here
|
|
13
|
+
export * from '@holoscript/core/parser';
|