@lokascript/framework 2.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.
Files changed (181) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +142 -0
  3. package/dist/aot/aot-orchestrator.d.ts +75 -0
  4. package/dist/aot/aot-orchestrator.d.ts.map +1 -0
  5. package/dist/aot/domain-scanner.d.ts +27 -0
  6. package/dist/aot/domain-scanner.d.ts.map +1 -0
  7. package/dist/aot/index.d.ts +8 -0
  8. package/dist/aot/index.d.ts.map +1 -0
  9. package/dist/aot/types.d.ts +103 -0
  10. package/dist/aot/types.d.ts.map +1 -0
  11. package/dist/api/create-dsl.d.ts +91 -0
  12. package/dist/api/create-dsl.d.ts.map +1 -0
  13. package/dist/api/dispatcher.d.ts +108 -0
  14. package/dist/api/dispatcher.d.ts.map +1 -0
  15. package/dist/api/domain-registry.d.ts +152 -0
  16. package/dist/api/domain-registry.d.ts.map +1 -0
  17. package/dist/api/index.d.ts +7 -0
  18. package/dist/api/index.d.ts.map +1 -0
  19. package/dist/api/index.js +2082 -0
  20. package/dist/api/index.js.map +1 -0
  21. package/dist/core/index.d.ts +7 -0
  22. package/dist/core/index.d.ts.map +1 -0
  23. package/dist/core/index.js +2674 -0
  24. package/dist/core/index.js.map +1 -0
  25. package/dist/core/logger.d.ts +32 -0
  26. package/dist/core/logger.d.ts.map +1 -0
  27. package/dist/core/pattern-matching/index.d.ts +6 -0
  28. package/dist/core/pattern-matching/index.d.ts.map +1 -0
  29. package/dist/core/pattern-matching/index.js +1239 -0
  30. package/dist/core/pattern-matching/index.js.map +1 -0
  31. package/dist/core/pattern-matching/pattern-matcher.d.ts +239 -0
  32. package/dist/core/pattern-matching/pattern-matcher.d.ts.map +1 -0
  33. package/dist/core/pattern-matching/utils/index.d.ts +6 -0
  34. package/dist/core/pattern-matching/utils/index.d.ts.map +1 -0
  35. package/dist/core/pattern-matching/utils/possessive-keywords.d.ts +38 -0
  36. package/dist/core/pattern-matching/utils/possessive-keywords.d.ts.map +1 -0
  37. package/dist/core/pattern-matching/utils/type-validation.d.ts +63 -0
  38. package/dist/core/pattern-matching/utils/type-validation.d.ts.map +1 -0
  39. package/dist/core/tokenization/base-tokenizer.d.ts +344 -0
  40. package/dist/core/tokenization/base-tokenizer.d.ts.map +1 -0
  41. package/dist/core/tokenization/char-classifiers.d.ts +56 -0
  42. package/dist/core/tokenization/char-classifiers.d.ts.map +1 -0
  43. package/dist/core/tokenization/default-extractors.d.ts +48 -0
  44. package/dist/core/tokenization/default-extractors.d.ts.map +1 -0
  45. package/dist/core/tokenization/extractors/index.d.ts +9 -0
  46. package/dist/core/tokenization/extractors/index.d.ts.map +1 -0
  47. package/dist/core/tokenization/extractors/operator.d.ts +23 -0
  48. package/dist/core/tokenization/extractors/operator.d.ts.map +1 -0
  49. package/dist/core/tokenization/extractors/punctuation.d.ts +22 -0
  50. package/dist/core/tokenization/extractors/punctuation.d.ts.map +1 -0
  51. package/dist/core/tokenization/extractors.d.ts +61 -0
  52. package/dist/core/tokenization/extractors.d.ts.map +1 -0
  53. package/dist/core/tokenization/index.d.ts +11 -0
  54. package/dist/core/tokenization/index.d.ts.map +1 -0
  55. package/dist/core/tokenization/index.js +1345 -0
  56. package/dist/core/tokenization/index.js.map +1 -0
  57. package/dist/core/tokenization/morphology/index.d.ts +5 -0
  58. package/dist/core/tokenization/morphology/index.d.ts.map +1 -0
  59. package/dist/core/tokenization/morphology/types.d.ts +110 -0
  60. package/dist/core/tokenization/morphology/types.d.ts.map +1 -0
  61. package/dist/core/tokenization/token-utils.d.ts +111 -0
  62. package/dist/core/tokenization/token-utils.d.ts.map +1 -0
  63. package/dist/core/types.d.ts +382 -0
  64. package/dist/core/types.d.ts.map +1 -0
  65. package/dist/core/types.js +108 -0
  66. package/dist/core/types.js.map +1 -0
  67. package/dist/generation/diagnostics.d.ts +120 -0
  68. package/dist/generation/diagnostics.d.ts.map +1 -0
  69. package/dist/generation/index.d.ts +7 -0
  70. package/dist/generation/index.d.ts.map +1 -0
  71. package/dist/generation/index.js +339 -0
  72. package/dist/generation/index.js.map +1 -0
  73. package/dist/generation/pattern-generator.d.ts +48 -0
  74. package/dist/generation/pattern-generator.d.ts.map +1 -0
  75. package/dist/generation/renderer.d.ts +115 -0
  76. package/dist/generation/renderer.d.ts.map +1 -0
  77. package/dist/grammar/index.d.ts +10 -0
  78. package/dist/grammar/index.d.ts.map +1 -0
  79. package/dist/grammar/index.js +391 -0
  80. package/dist/grammar/index.js.map +1 -0
  81. package/dist/grammar/transformer.d.ts +56 -0
  82. package/dist/grammar/transformer.d.ts.map +1 -0
  83. package/dist/grammar/types.d.ts +236 -0
  84. package/dist/grammar/types.d.ts.map +1 -0
  85. package/dist/index.cjs +4454 -0
  86. package/dist/index.cjs.map +1 -0
  87. package/dist/index.d.ts +46 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +4336 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/interfaces/dictionary.d.ts +82 -0
  92. package/dist/interfaces/dictionary.d.ts.map +1 -0
  93. package/dist/interfaces/index.d.ts +10 -0
  94. package/dist/interfaces/index.d.ts.map +1 -0
  95. package/dist/interfaces/profile-provider.d.ts +67 -0
  96. package/dist/interfaces/profile-provider.d.ts.map +1 -0
  97. package/dist/interfaces/value-extractor.d.ts +168 -0
  98. package/dist/interfaces/value-extractor.d.ts.map +1 -0
  99. package/dist/multilingual/index.d.ts +8 -0
  100. package/dist/multilingual/index.d.ts.map +1 -0
  101. package/dist/multilingual/index.js +1 -0
  102. package/dist/multilingual/index.js.map +1 -0
  103. package/dist/parsing/index.d.ts +8 -0
  104. package/dist/parsing/index.d.ts.map +1 -0
  105. package/dist/parsing/index.js +1415 -0
  106. package/dist/parsing/index.js.map +1 -0
  107. package/dist/parsing/multi-statement.d.ts +265 -0
  108. package/dist/parsing/multi-statement.d.ts.map +1 -0
  109. package/dist/schema/command-schema.d.ts +78 -0
  110. package/dist/schema/command-schema.d.ts.map +1 -0
  111. package/dist/schema/index.d.ts +5 -0
  112. package/dist/schema/index.d.ts.map +1 -0
  113. package/dist/schema/index.js +25 -0
  114. package/dist/schema/index.js.map +1 -0
  115. package/dist/test-setup.d.ts +9 -0
  116. package/dist/test-setup.d.ts.map +1 -0
  117. package/dist/testing/index.d.ts +50 -0
  118. package/dist/testing/index.d.ts.map +1 -0
  119. package/dist/testing/index.js +16969 -0
  120. package/dist/testing/index.js.map +1 -0
  121. package/package.json +122 -0
  122. package/src/__test__/fixtures/sql-dsl.ts +232 -0
  123. package/src/__test__/sql-integration.test.ts +189 -0
  124. package/src/__test__/test-utils.ts +260 -0
  125. package/src/aot/aot-orchestrator.test.ts +413 -0
  126. package/src/aot/aot-orchestrator.ts +238 -0
  127. package/src/aot/domain-scanner.ts +178 -0
  128. package/src/aot/index.ts +8 -0
  129. package/src/aot/types.ts +124 -0
  130. package/src/api/create-dsl.ts +367 -0
  131. package/src/api/dispatcher.test.ts +336 -0
  132. package/src/api/dispatcher.ts +222 -0
  133. package/src/api/domain-registry.test.ts +336 -0
  134. package/src/api/domain-registry.ts +500 -0
  135. package/src/api/index.ts +7 -0
  136. package/src/core/index.ts +7 -0
  137. package/src/core/logger.ts +130 -0
  138. package/src/core/pattern-matching/index.ts +6 -0
  139. package/src/core/pattern-matching/pattern-matcher.test.ts +900 -0
  140. package/src/core/pattern-matching/pattern-matcher.ts +1548 -0
  141. package/src/core/pattern-matching/pattern-matcher.ts.backup +1267 -0
  142. package/src/core/pattern-matching/utils/index.ts +6 -0
  143. package/src/core/pattern-matching/utils/possessive-keywords.ts +55 -0
  144. package/src/core/pattern-matching/utils/type-validation.test.ts +316 -0
  145. package/src/core/pattern-matching/utils/type-validation.ts +134 -0
  146. package/src/core/tokenization/base-tokenizer.ts +916 -0
  147. package/src/core/tokenization/char-classifiers.ts +79 -0
  148. package/src/core/tokenization/create-simple-tokenizer.test.ts +260 -0
  149. package/src/core/tokenization/default-extractors.ts +69 -0
  150. package/src/core/tokenization/extractors/index.ts +9 -0
  151. package/src/core/tokenization/extractors/operator.ts +75 -0
  152. package/src/core/tokenization/extractors/punctuation.ts +39 -0
  153. package/src/core/tokenization/extractors.ts +452 -0
  154. package/src/core/tokenization/index.ts +11 -0
  155. package/src/core/tokenization/morphology/index.ts +5 -0
  156. package/src/core/tokenization/morphology/types.ts +211 -0
  157. package/src/core/tokenization/token-utils.ts +252 -0
  158. package/src/core/types.ts +589 -0
  159. package/src/generation/diagnostics.test.ts +171 -0
  160. package/src/generation/diagnostics.ts +239 -0
  161. package/src/generation/index.ts +7 -0
  162. package/src/generation/pattern-generator.test.ts +430 -0
  163. package/src/generation/pattern-generator.ts +315 -0
  164. package/src/generation/renderer.test.ts +266 -0
  165. package/src/generation/renderer.ts +244 -0
  166. package/src/grammar/index.ts +12 -0
  167. package/src/grammar/transformer.ts +159 -0
  168. package/src/grammar/types.ts +630 -0
  169. package/src/index.ts +157 -0
  170. package/src/interfaces/dictionary.ts +123 -0
  171. package/src/interfaces/index.ts +10 -0
  172. package/src/interfaces/profile-provider.ts +88 -0
  173. package/src/interfaces/value-extractor.ts +435 -0
  174. package/src/multilingual/index.ts +9 -0
  175. package/src/parsing/index.ts +27 -0
  176. package/src/parsing/multi-statement.test.ts +480 -0
  177. package/src/parsing/multi-statement.ts +648 -0
  178. package/src/schema/command-schema.ts +118 -0
  179. package/src/schema/index.ts +5 -0
  180. package/src/test-setup.ts +45 -0
  181. package/src/testing/index.ts +137 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 LokaScript Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,142 @@
1
+ # @lokascript/framework
2
+
3
+ > **Generic framework for building multilingual domain-specific languages (DSLs)**
4
+
5
+ Build DSLs that work in 24+ human languages with semantic parsing, pattern generation, and grammar transformation.
6
+
7
+ ## Features
8
+
9
+ - **🌍 Multilingual**: Support 24+ languages out of the box (English, Japanese, Spanish, Arabic, etc.)
10
+ - **🧠 Semantic Parsing**: Parse natural language commands into language-neutral semantic representations
11
+ - **🔄 Grammar Transformation**: Automatically handle word order (SVO/SOV/VSO) and grammatical markers
12
+ - **📦 Zero Dependencies**: Pure TypeScript, no runtime dependencies
13
+ - **🎯 Type-Safe**: Full TypeScript support with generic types
14
+ - **🔌 Extensible**: Custom roles, value types, and transformation rules
15
+ - **⚡ Fast**: Efficient pattern matching and caching
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @lokascript/framework
21
+ ```
22
+
23
+ ## Quick Start
24
+
25
+ ```typescript
26
+ import { createMultilingualDSL } from '@lokascript/framework';
27
+
28
+ // Define your DSL's commands
29
+ const selectCommand = {
30
+ action: 'select',
31
+ primaryRole: 'columns',
32
+ roles: [
33
+ { role: 'columns', required: true, expectedTypes: ['expression'] },
34
+ { role: 'source', required: true, expectedTypes: ['literal'] },
35
+ ],
36
+ };
37
+
38
+ // Create your DSL instance
39
+ const sqlDSL = createMultilingualDSL({
40
+ schemas: [selectCommand],
41
+ languages: [
42
+ {
43
+ code: 'en',
44
+ profile: { wordOrder: 'SVO', keywords: { select: 'select' } },
45
+ tokenizer: new EnglishTokenizer(),
46
+ },
47
+ ],
48
+ });
49
+
50
+ // Use your DSL
51
+ const node = sqlDSL.parse('select name from users', 'en');
52
+ // → { action: 'select', roles: { columns: 'name', source: 'users' } }
53
+ ```
54
+
55
+ ## Core Concepts
56
+
57
+ ### Semantic Roles
58
+
59
+ Commands are represented as **semantic roles** rather than positional arguments:
60
+
61
+ ```typescript
62
+ // Traditional (positional)
63
+ command('toggle', '.active', '#button');
64
+
65
+ // Semantic (role-based)
66
+ {
67
+ action: 'toggle',
68
+ roles: {
69
+ patient: '.active', // What is being acted upon
70
+ destination: '#button' // Where it's being toggled
71
+ }
72
+ }
73
+ ```
74
+
75
+ This enables:
76
+
77
+ - Language-independent meaning
78
+ - Automatic word order transformation
79
+ - Clear intent for code generation
80
+
81
+ ### Word Order Transformation
82
+
83
+ The framework automatically handles different word orders:
84
+
85
+ ```typescript
86
+ // English (SVO): Subject-Verb-Object
87
+ 'toggle .active on #button';
88
+
89
+ // Japanese (SOV): Subject-Object-Verb
90
+ '#button の .active を トグル';
91
+
92
+ // Arabic (VSO): Verb-Subject-Object
93
+ 'بدّل .active على #button';
94
+
95
+ // All parse to the same semantic representation!
96
+ ```
97
+
98
+ ### Pattern Generation
99
+
100
+ Instead of writing patterns by hand, define schemas and let the framework generate patterns:
101
+
102
+ ```typescript
103
+ // Define once
104
+ const schema = {
105
+ action: 'select',
106
+ roles: [
107
+ { role: 'columns', required: true },
108
+ { role: 'source', required: true, markerOverride: { en: 'from', ja: 'から' } },
109
+ ],
110
+ };
111
+
112
+ // Framework generates patterns for all languages automatically
113
+ // English: "select [columns] from [source]"
114
+ // Japanese: "[source] から [columns] を 選択"
115
+ ```
116
+
117
+ ## Documentation
118
+
119
+ - [API Reference](./docs/API.md)
120
+ - [Language Profiles](./docs/LANGUAGE_PROFILES.md)
121
+ - [Grammar Transformation](./docs/GRAMMAR.md)
122
+ - [Examples](./examples/)
123
+
124
+ ## Examples
125
+
126
+ - [SQL DSL](./examples/sql-dsl/) - Query language in English + Spanish
127
+ - [Animation DSL](./examples/animation-dsl/) - Animation commands in English + Japanese
128
+ - [Form Validation DSL](./examples/validation-dsl/) - Validation rules
129
+
130
+ ## Status
131
+
132
+ 🚧 **Alpha** - API is stable but may change before 1.0.0
133
+
134
+ Currently extracted from [HyperFixi/LokaScript](https://github.com/codetalcott/hyperfixi), a production-tested multilingual hyperscript implementation with:
135
+
136
+ - 8100+ tests passing
137
+ - 24 languages supported
138
+ - Used in real applications
139
+
140
+ ## License
141
+
142
+ MIT © LokaScript Contributors
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Generalized AOT Orchestrator
3
+ *
4
+ * Coordinates scan → parse → compile → collect for any domain.
5
+ * Each domain provides a DomainCompilationBackend (DSL + CodeGenerator + scan config),
6
+ * and the orchestrator handles the rest.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { AOTOrchestrator } from '@lokascript/framework';
11
+ *
12
+ * const orchestrator = new AOTOrchestrator();
13
+ *
14
+ * orchestrator.registerBackend({
15
+ * domain: 'sql',
16
+ * dsl: createSQLDSL(),
17
+ * codeGenerator: sqlCodeGenerator,
18
+ * scanConfig: {
19
+ * domain: 'sql',
20
+ * attributes: ['data-sql'],
21
+ * scriptTypes: ['text/sql-dsl'],
22
+ * },
23
+ * });
24
+ *
25
+ * const result = await orchestrator.compileFiles(
26
+ * ['index.html', 'about.html'],
27
+ * (path) => fs.promises.readFile(path, 'utf-8')
28
+ * );
29
+ * ```
30
+ */
31
+ import type { MultilingualDSL, CodeGenerator } from '../api/create-dsl';
32
+ import type { DomainScanConfig, ExtractedSnippet, CompiledSnippet, AOTBatchResult, GeneralizedAOTOptions, OutputOptions } from './types';
33
+ /**
34
+ * Per-domain compilation backend.
35
+ * Provides everything needed to scan, parse, and compile a domain's syntax.
36
+ */
37
+ export interface DomainCompilationBackend {
38
+ /** Domain name (must match scanConfig.domain) */
39
+ readonly domain: string;
40
+ /** The DSL instance for parsing and compilation */
41
+ readonly dsl: MultilingualDSL;
42
+ /** Code generator for producing target code from semantic nodes */
43
+ readonly codeGenerator: CodeGenerator;
44
+ /** Scan configuration declaring HTML attribute patterns */
45
+ readonly scanConfig: DomainScanConfig;
46
+ }
47
+ /**
48
+ * Generalized AOT orchestrator for any domain.
49
+ */
50
+ export declare class AOTOrchestrator {
51
+ private backends;
52
+ private options;
53
+ constructor(options?: GeneralizedAOTOptions);
54
+ /**
55
+ * Register a domain compilation backend.
56
+ * @throws if a backend with the same domain name is already registered
57
+ */
58
+ registerBackend(backend: DomainCompilationBackend): void;
59
+ /**
60
+ * Scan source files and compile all domain snippets.
61
+ */
62
+ compileFiles(files: string[], readFile: (path: string) => Promise<string>): Promise<AOTBatchResult>;
63
+ /**
64
+ * Compile a single extracted snippet.
65
+ * Returns the compiled result or an error object.
66
+ */
67
+ compileSnippet(snippet: ExtractedSnippet): CompiledSnippet | {
68
+ error: string;
69
+ };
70
+ /**
71
+ * Generate combined output from compilation results.
72
+ */
73
+ generateOutput(result: AOTBatchResult, options?: OutputOptions): string;
74
+ }
75
+ //# sourceMappingURL=aot-orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aot-orchestrator.d.ts","sourceRoot":"","sources":["../../src/aot/aot-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,aAAa,EACd,MAAM,SAAS,CAAC;AAOjB;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;CACvC;AAMD;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAA+C;IAC/D,OAAO,CAAC,OAAO,CAAkC;gBAErC,OAAO,CAAC,EAAE,qBAAqB;IAQ3C;;;OAGG;IACH,eAAe,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI;IAOxD;;OAEG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC1C,OAAO,CAAC,cAAc,CAAC;IA+C1B;;;OAGG;IACH,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,eAAe,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE;IAyB9E;;OAEG;IACH,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM;CA6DxE"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Domain-Aware Scanner
3
+ *
4
+ * Extracts DSL snippets from HTML/template files based on domain-declared
5
+ * attribute patterns and script types. Unlike the hyperscript-specific
6
+ * HTMLScanner, this scanner is configured dynamically from DomainScanConfig.
7
+ */
8
+ import type { DomainScanConfig, ExtractedSnippet } from './types';
9
+ /**
10
+ * Scans HTML/template files for domain-specific snippets.
11
+ *
12
+ * Configured by DomainScanConfig objects, each declaring which
13
+ * HTML attributes and script types a domain uses.
14
+ */
15
+ export declare class DomainAwareScanner {
16
+ private configs;
17
+ constructor(configs: readonly DomainScanConfig[]);
18
+ /**
19
+ * Extract all domain snippets from an HTML source string.
20
+ */
21
+ extract(source: string, filename: string): ExtractedSnippet[];
22
+ /**
23
+ * Extract snippets from multiple files.
24
+ */
25
+ extractFromFiles(files: string[], readFile: (path: string) => Promise<string>): Promise<ExtractedSnippet[]>;
26
+ }
27
+ //# sourceMappingURL=domain-scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-scanner.d.ts","sourceRoot":"","sources":["../../src/aot/domain-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAyElE;;;;;GAKG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,OAAO,CAA8B;gBAEjC,OAAO,EAAE,SAAS,gBAAgB,EAAE;IAIhD;;OAEG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,EAAE;IA2D7D;;OAEG;IACG,gBAAgB,CACpB,KAAK,EAAE,MAAM,EAAE,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAC1C,OAAO,CAAC,gBAAgB,EAAE,CAAC;CAe/B"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Generalized AOT compilation for any domain.
3
+ */
4
+ export * from './types';
5
+ export { DomainAwareScanner } from './domain-scanner';
6
+ export { AOTOrchestrator } from './aot-orchestrator';
7
+ export type { DomainCompilationBackend } from './aot-orchestrator';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aot/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Generalized AOT Type Definitions
3
+ *
4
+ * Types for the domain-agnostic Ahead-of-Time compilation system.
5
+ * Any domain that provides a MultilingualDSL and CodeGenerator can use this.
6
+ */
7
+ /**
8
+ * How a domain declares its HTML attribute patterns for scanning.
9
+ */
10
+ export interface DomainScanConfig {
11
+ /** Domain name (should match DomainDescriptor.name) */
12
+ readonly domain: string;
13
+ /** Attribute names to scan for (e.g., ['data-sql', '_sql']) */
14
+ readonly attributes: readonly string[];
15
+ /** Script tag types to scan for (e.g., ['text/sql-dsl']) */
16
+ readonly scriptTypes?: readonly string[];
17
+ /** Default language when not specified on element (default: 'en') */
18
+ readonly defaultLanguage?: string;
19
+ }
20
+ /**
21
+ * A snippet extracted from a source file, tagged with its domain.
22
+ */
23
+ export interface ExtractedSnippet {
24
+ /** Domain this snippet belongs to */
25
+ readonly domain: string;
26
+ /** The DSL code */
27
+ readonly code: string;
28
+ /** Language code (from element's lang attribute or default) */
29
+ readonly language: string;
30
+ /** Source file path */
31
+ readonly file: string;
32
+ /** Line number in source file (1-based) */
33
+ readonly line: number;
34
+ /** Column number in source file (1-based) */
35
+ readonly column: number;
36
+ /** Element ID if available */
37
+ readonly elementId?: string;
38
+ /** CSS selector for the element */
39
+ readonly elementSelector?: string;
40
+ }
41
+ /**
42
+ * Result of compiling a single snippet.
43
+ */
44
+ export interface CompiledSnippet {
45
+ /** Domain that compiled this snippet */
46
+ readonly domain: string;
47
+ /** Original source code */
48
+ readonly source: string;
49
+ /** Compiled output */
50
+ readonly compiled: string;
51
+ /** Source language */
52
+ readonly language: string;
53
+ /** Source file path */
54
+ readonly file: string;
55
+ /** Line number in source file */
56
+ readonly line: number;
57
+ }
58
+ /**
59
+ * Result of batch-compiling all snippets from a project.
60
+ */
61
+ export interface AOTBatchResult {
62
+ /** Successfully compiled snippets */
63
+ readonly compiled: readonly CompiledSnippet[];
64
+ /** Snippets that failed compilation */
65
+ readonly errors: ReadonlyArray<{
66
+ readonly domain: string;
67
+ readonly source: string;
68
+ readonly file: string;
69
+ readonly line: number;
70
+ readonly message: string;
71
+ }>;
72
+ /** Summary statistics */
73
+ readonly stats: {
74
+ readonly totalSnippets: number;
75
+ readonly compiledCount: number;
76
+ readonly errorCount: number;
77
+ /** Number of snippets per domain */
78
+ readonly domainBreakdown: Record<string, number>;
79
+ };
80
+ }
81
+ /**
82
+ * Options for the generalized AOT compiler.
83
+ */
84
+ export interface GeneralizedAOTOptions {
85
+ /** Minimum confidence for semantic parsing (default: 0.7) */
86
+ readonly confidenceThreshold?: number;
87
+ /** Continue compiling other snippets on individual errors (default: true) */
88
+ readonly continueOnError?: boolean;
89
+ /** Debug mode — log extraction and compilation details */
90
+ readonly debug?: boolean;
91
+ }
92
+ /**
93
+ * Options for generating combined output.
94
+ */
95
+ export interface OutputOptions {
96
+ /** Module format (default: 'esm') */
97
+ readonly format?: 'esm' | 'cjs' | 'iife';
98
+ /** Include source location comments (default: true) */
99
+ readonly includeComments?: boolean;
100
+ /** Group output by domain (default: true) */
101
+ readonly groupByDomain?: boolean;
102
+ }
103
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/aot/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,qEAAqE;IACrE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;CACnC;AAMD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mBAAmB;IACnB,QAAQ,CAAC,IAAI,EAAE,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,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;QAC5B,oCAAoC;QACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClD,CAAC;CACH;AAMD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,6DAA6D;IAC7D,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;IACzC,uDAAuD;IACvD,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Main API for creating multilingual DSLs
3
+ */
4
+ import type { SemanticNode, LanguageTokenizer, LanguagePattern } from '../core/types';
5
+ import type { CommandSchema } from '../schema';
6
+ import { type PatternGenLanguageProfile } from '../generation/pattern-generator';
7
+ import { type LanguageProfile as GrammarProfile } from '../grammar';
8
+ import { type Dictionary, type ProfileProvider, type ValueExtractor } from '../interfaces';
9
+ /**
10
+ * Language configuration for a DSL.
11
+ */
12
+ export interface LanguageConfig {
13
+ /** ISO 639-1 language code */
14
+ readonly code: string;
15
+ /** English name of the language */
16
+ readonly name: string;
17
+ /** Native name of the language */
18
+ readonly nativeName: string;
19
+ /** Language tokenizer */
20
+ readonly tokenizer: LanguageTokenizer;
21
+ /** Language profile for pattern generation */
22
+ readonly patternProfile: PatternGenLanguageProfile;
23
+ /** Language profile for grammar transformation (optional) */
24
+ readonly grammarProfile?: GrammarProfile;
25
+ }
26
+ /**
27
+ * Code generator function that transforms semantic AST to target code.
28
+ */
29
+ export interface CodeGenerator {
30
+ generate(node: SemanticNode): string;
31
+ }
32
+ /**
33
+ * DSL configuration with dependency injection support.
34
+ */
35
+ export interface DSLConfig {
36
+ /** DSL name (for debugging/documentation) */
37
+ readonly name?: string;
38
+ /** Command schemas defining the DSL grammar */
39
+ readonly schemas: readonly CommandSchema[];
40
+ /** Language configurations */
41
+ readonly languages: readonly LanguageConfig[];
42
+ /** Dictionary for keyword translation (default: built from language configs) */
43
+ readonly dictionary?: Dictionary;
44
+ /** Profile provider for grammar transformation (default: built from language configs) */
45
+ readonly profileProvider?: ProfileProvider;
46
+ /** Value extractors for tokenization (default: generic extractors) */
47
+ readonly valueExtractors?: ValueExtractor[];
48
+ /** Code generator for compilation (default: none) */
49
+ readonly codeGenerator?: CodeGenerator;
50
+ /** Auto-generate patterns from schemas (default: true) */
51
+ readonly generatePatterns?: boolean;
52
+ /** Custom patterns to supplement generated ones */
53
+ readonly customPatterns?: LanguagePattern[];
54
+ }
55
+ /**
56
+ * Validation result.
57
+ */
58
+ export interface ValidationResult {
59
+ readonly valid: boolean;
60
+ readonly node?: SemanticNode;
61
+ readonly errors?: string[];
62
+ }
63
+ /**
64
+ * Compilation result.
65
+ */
66
+ export interface CompileResult {
67
+ readonly ok: boolean;
68
+ readonly code?: string;
69
+ readonly errors?: string[];
70
+ readonly node?: SemanticNode;
71
+ readonly metadata?: {
72
+ readonly parser: string;
73
+ readonly confidence: number;
74
+ };
75
+ }
76
+ /**
77
+ * Main multilingual DSL interface.
78
+ */
79
+ export interface MultilingualDSL {
80
+ parse(input: string, language: string): SemanticNode;
81
+ parseWithConfidence(input: string, language: string): {
82
+ node: SemanticNode;
83
+ confidence: number;
84
+ };
85
+ validate(input: string, language: string): ValidationResult;
86
+ compile(input: string, language: string): CompileResult;
87
+ translate(input: string, fromLanguage: string, toLanguage: string): string;
88
+ getSupportedLanguages(): string[];
89
+ }
90
+ export declare function createMultilingualDSL(config: DSLConfig): MultilingualDSL;
91
+ //# sourceMappingURL=create-dsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-dsl.d.ts","sourceRoot":"","sources":["../../src/api/create-dsl.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAmB,KAAK,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAsB,KAAK,eAAe,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EAGpB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IACtC,8CAA8C;IAC9C,QAAQ,CAAC,cAAc,EAAE,yBAAyB,CAAC;IACnD,6DAA6D;IAC7D,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB,+CAA+C;IAC/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mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAGjG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAG5D,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;IAGxD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;IAG3E,qBAAqB,IAAI,MAAM,EAAE,CAAC;CACnC;AAsOD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,eAAe,CAgBxE"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Cross-Domain Dispatcher
3
+ *
4
+ * Routes natural-language input to the correct domain by trying all registered
5
+ * domains and picking the highest-confidence match. Supports auto-detection,
6
+ * composite multi-line parsing, and confidence-based routing.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { DomainRegistry, CrossDomainDispatcher } from '@lokascript/framework';
11
+ *
12
+ * const registry = new DomainRegistry();
13
+ * registry.register(sqlDescriptor);
14
+ * registry.register(bddDescriptor);
15
+ *
16
+ * const dispatcher = new CrossDomainDispatcher(registry);
17
+ *
18
+ * // Auto-detect which domain handles the input
19
+ * const result = await dispatcher.detect('select name from users', 'en');
20
+ * // → { domain: 'sql', node: ..., confidence: 0.95, dsl: ... }
21
+ *
22
+ * // Parse multi-line input across domains
23
+ * const composite = await dispatcher.parseComposite(`
24
+ * select name from users
25
+ * given page http://localhost
26
+ * `, 'en');
27
+ * ```
28
+ */
29
+ import type { SemanticNode } from '../core/types';
30
+ import type { MultilingualDSL, CompileResult, ValidationResult } from './create-dsl';
31
+ import { DomainRegistry } from './domain-registry';
32
+ /** Result of domain auto-detection */
33
+ export interface DispatchResult {
34
+ /** The domain that matched */
35
+ readonly domain: string;
36
+ /** Parsed semantic node */
37
+ readonly node: SemanticNode;
38
+ /** Confidence score (0-1) */
39
+ readonly confidence: number;
40
+ /** The DSL instance that parsed it */
41
+ readonly dsl: MultilingualDSL;
42
+ }
43
+ /** A single statement in a composite parse result */
44
+ export interface CompositeStatement {
45
+ readonly line: number;
46
+ readonly input: string;
47
+ readonly domain: string;
48
+ readonly node: SemanticNode;
49
+ readonly confidence: number;
50
+ }
51
+ /** An error from a composite parse */
52
+ export interface CompositeError {
53
+ readonly line: number;
54
+ readonly input: string;
55
+ readonly message: string;
56
+ }
57
+ /** Result of multi-domain composite parsing */
58
+ export interface CompositeParseResult {
59
+ /** Successfully parsed statements */
60
+ readonly statements: readonly CompositeStatement[];
61
+ /** Lines that could not be matched to any domain */
62
+ readonly errors: readonly CompositeError[];
63
+ }
64
+ /** Dispatcher configuration options */
65
+ export interface DispatcherOptions {
66
+ /** Minimum confidence to accept a match (default: 0.5) */
67
+ readonly minConfidence?: number;
68
+ /** Domain priority order — earlier domains win on confidence ties */
69
+ readonly priority?: readonly string[];
70
+ }
71
+ /**
72
+ * Dispatcher that routes input to the correct domain by confidence scoring.
73
+ *
74
+ * Built on top of DomainRegistry — uses registered domains' DSL instances
75
+ * to try parsing input and picks the highest-confidence match.
76
+ */
77
+ export declare class CrossDomainDispatcher {
78
+ private registry;
79
+ private minConfidence;
80
+ private priority;
81
+ constructor(registry: DomainRegistry, options?: DispatcherOptions);
82
+ /**
83
+ * Auto-detect which domain handles the input.
84
+ * Tries all registered domains and returns the highest-confidence match.
85
+ * Returns null if no domain matches above minConfidence.
86
+ */
87
+ detect(input: string, language?: string): Promise<DispatchResult | null>;
88
+ /**
89
+ * Parse multi-line input where each line may belong to a different domain.
90
+ * Empty lines and comment lines (starting with //, --, or #) are skipped.
91
+ */
92
+ parseComposite(input: string, language?: string): Promise<CompositeParseResult>;
93
+ /**
94
+ * Compile input using auto-detected domain.
95
+ * Returns the compilation result with the domain name.
96
+ */
97
+ compile(input: string, language?: string): Promise<(CompileResult & {
98
+ domain: string;
99
+ }) | null>;
100
+ /**
101
+ * Validate input against all domains, returning the best match.
102
+ */
103
+ validate(input: string, language?: string): Promise<ValidationResult & {
104
+ domain?: string;
105
+ }>;
106
+ private getPriorityIndex;
107
+ }
108
+ //# sourceMappingURL=dispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatcher.d.ts","sourceRoot":"","sources":["../../src/api/dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMnD,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,8BAA8B;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,6BAA6B;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC;CAC/B;AAED,qDAAqD;AACrD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,sCAAsC;AACtC,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAA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