enyosx-ai 0.1.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 (41) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +740 -0
  3. package/dist/chunk-2WM5L76D.js +320 -0
  4. package/dist/chunk-3BNDFBX3.js +324 -0
  5. package/dist/chunk-4LJILSCT.js +30 -0
  6. package/dist/chunk-4ZV5JV6W.js +298 -0
  7. package/dist/chunk-76PHNPTY.js +631 -0
  8. package/dist/chunk-BSSA33NY.js +677 -0
  9. package/dist/chunk-EK6IDRY7.js +105 -0
  10. package/dist/chunk-FI2EBH2N.js +2232 -0
  11. package/dist/chunk-GAKKLY4M.js +276 -0
  12. package/dist/chunk-HR4G5XQI.js +319 -0
  13. package/dist/chunk-HROGCEE5.js +30 -0
  14. package/dist/chunk-MMH7M7MG.js +30 -0
  15. package/dist/chunk-NGLRXS6G.js +2079 -0
  16. package/dist/chunk-NSE6LQJC.js +681 -0
  17. package/dist/chunk-O5XZOSBW.js +2484 -0
  18. package/dist/chunk-OVCMUPMP.js +677 -0
  19. package/dist/chunk-P2YBRE3X.js +2484 -0
  20. package/dist/chunk-VVIL5NIM.js +318 -0
  21. package/dist/chunk-ZNGEBY33.js +273 -0
  22. package/dist/cli.cjs +2509 -0
  23. package/dist/cli.d.ts +1 -0
  24. package/dist/cli.js +99 -0
  25. package/dist/index.cjs +2912 -0
  26. package/dist/index.d.ts +672 -0
  27. package/dist/index.js +379 -0
  28. package/dist/parser-4JXKOWKY.js +8 -0
  29. package/dist/parser-UUB6D2CZ.js +8 -0
  30. package/dist/parser-V44AIVNI.js +8 -0
  31. package/examples/README.md +13 -0
  32. package/examples/ia-demo.eny +37 -0
  33. package/examples/sample.eny +15 -0
  34. package/examples/simple/system.eny +7 -0
  35. package/examples/spec/sample.eny +19 -0
  36. package/examples/starter/README.md +96 -0
  37. package/examples/starter/main.eny +39 -0
  38. package/examples/starter/run.js +68 -0
  39. package/examples/starter.eny +16 -0
  40. package/examples/wasm-demo.eny +34 -0
  41. package/package.json +49 -0
@@ -0,0 +1,105 @@
1
+ // src/parser.ts
2
+ function parse(code) {
3
+ const ast = { raw: code, functions: [], ias: [], nodes: [] };
4
+ const lines = code.split(/\r?\n/);
5
+ let i = 0;
6
+ while (i < lines.length) {
7
+ const raw = lines[i];
8
+ const line = raw.trim();
9
+ if (!line) {
10
+ i++;
11
+ continue;
12
+ }
13
+ if (/^Σ\s+SYSTEM/i.test(line)) {
14
+ const m = line.match(/^Σ\s+SYSTEM\s+"([^"]+)"/i);
15
+ ast.system = m ? m[1] : line.replace(/^Σ\s+SYSTEM\s*/i, "");
16
+ i++;
17
+ continue;
18
+ }
19
+ if (/^Σ\s+MODE/i.test(line)) {
20
+ const m = line.match(/^Σ\s+MODE\s+([\w-]+)/i);
21
+ ast.mode = m ? m[1] : null;
22
+ i++;
23
+ continue;
24
+ }
25
+ if (/^Σ\s+UI/i.test(line)) {
26
+ const m = line.match(/^Σ\s+UI\s+([\w-]+)/i);
27
+ ast.ui = m ? m[1] : null;
28
+ i++;
29
+ continue;
30
+ }
31
+ if (/^Δ\s+([\w_]+)\s*\(([^)]*)\)/.test(line)) {
32
+ const m = line.match(/^Δ\s+([\w_]+)\s*\(([^)]*)\)/);
33
+ const name = m ? m[1] : "anonymous";
34
+ const argsRaw = m ? m[2] : "";
35
+ const args = argsRaw ? argsRaw.split(",").map((s) => s.trim()).filter(Boolean) : [];
36
+ const steps = [];
37
+ i++;
38
+ while (i < lines.length) {
39
+ const l = lines[i];
40
+ if (!l.trim()) {
41
+ i++;
42
+ continue;
43
+ }
44
+ if (/^→/.test(l.trim()) || /^\s+→/.test(l) || /^\s+/.test(l)) {
45
+ steps.push({ raw: l.trim().replace(/^→\s?/, "") });
46
+ i++;
47
+ } else {
48
+ break;
49
+ }
50
+ }
51
+ const fn = { type: "function", name, args, steps };
52
+ ast.functions.push(fn);
53
+ ast.nodes.push(fn);
54
+ continue;
55
+ }
56
+ if (/^Ψ\s+IA\s+([\w-]+)\s*\{?/.test(line)) {
57
+ const m = line.match(/^Ψ\s+IA\s+([\w-]+)\s*\{?/);
58
+ const name = m ? m[1] : "ia";
59
+ const body = [];
60
+ if (/\{$/.test(line)) {
61
+ i++;
62
+ while (i < lines.length && !/\}/.test(lines[i])) {
63
+ body.push(lines[i].trim());
64
+ i++;
65
+ }
66
+ if (i < lines.length && /\}/.test(lines[i]))
67
+ i++;
68
+ } else {
69
+ i++;
70
+ while (i < lines.length) {
71
+ const l = lines[i];
72
+ if (!l.trim()) {
73
+ i++;
74
+ break;
75
+ }
76
+ if (/^Σ|^Δ|^Ψ/.test(l.trim()))
77
+ break;
78
+ body.push(l.trim());
79
+ i++;
80
+ }
81
+ }
82
+ const ia = { type: "ia", name, body };
83
+ ast.ias.push(ia);
84
+ ast.nodes.push(ia);
85
+ continue;
86
+ }
87
+ if (/^Σ\s+EVOLVE/i.test(line)) {
88
+ i++;
89
+ while (i < lines.length && !!lines[i].trim() && !/^Σ|^Δ|^Ψ/.test(lines[i].trim()))
90
+ i++;
91
+ continue;
92
+ }
93
+ i++;
94
+ }
95
+ return ast;
96
+ }
97
+
98
+ // src/runENY.ts
99
+ function runENY(code) {
100
+ return parse(code);
101
+ }
102
+
103
+ export {
104
+ runENY
105
+ };