cobolx-2 1.2.3

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 (284) hide show
  1. package/.github/pull_request_template.md +9 -0
  2. package/.github/workflows/ci.yml +18 -0
  3. package/.vscode/launch.json +19 -0
  4. package/.vscode/tasks.json +14 -0
  5. package/CHANGELOG.md +16 -0
  6. package/CONTRIBUTING.md +23 -0
  7. package/CargoX.lock +2 -0
  8. package/LICENSE +21 -0
  9. package/README.md +164 -0
  10. package/api-demo/CargoX.lock +1 -0
  11. package/api-demo/README.md +3 -0
  12. package/api-demo/benchmarks/arith.cbx +6 -0
  13. package/api-demo/cobolx.toml +6 -0
  14. package/api-demo/docs-output/index.html +1 -0
  15. package/api-demo/generated/LEGACYDEMO.cbx +5 -0
  16. package/api-demo/generated/client-types.ts +2 -0
  17. package/api-demo/generated/deploy.json +12 -0
  18. package/api-demo/generated/flowchart.mmd +4 -0
  19. package/api-demo/migrations/20260411215238_init.sql +1 -0
  20. package/api-demo/src/main.cbx +5 -0
  21. package/api-demo/tests/smoke.cbx +6 -0
  22. package/benchmarks/arithmetic.cbx +6 -0
  23. package/cargox/package.json +11 -0
  24. package/cargox/src/index.d.ts +4 -0
  25. package/cargox/src/index.js +5 -0
  26. package/cargox/src/index.js.map +1 -0
  27. package/cargox/src/index.ts +4 -0
  28. package/cargox/src/lockfile/index.d.ts +1 -0
  29. package/cargox/src/lockfile/index.js +9 -0
  30. package/cargox/src/lockfile/index.js.map +1 -0
  31. package/cargox/src/lockfile/index.ts +9 -0
  32. package/cargox/src/manifest.d.ts +10 -0
  33. package/cargox/src/manifest.js +49 -0
  34. package/cargox/src/manifest.js.map +1 -0
  35. package/cargox/src/manifest.ts +58 -0
  36. package/cargox/src/registry/index.d.ts +4 -0
  37. package/cargox/src/registry/index.js +13 -0
  38. package/cargox/src/registry/index.js.map +1 -0
  39. package/cargox/src/registry/index.ts +13 -0
  40. package/cargox/src/resolver/index.d.ts +5 -0
  41. package/cargox/src/resolver/index.js +4 -0
  42. package/cargox/src/resolver/index.js.map +1 -0
  43. package/cargox/src/resolver/index.ts +8 -0
  44. package/cargox/tsconfig.json +7 -0
  45. package/cli/cobolx-cli/package.json +23 -0
  46. package/cli/cobolx-cli/src/commands/add.ts +18 -0
  47. package/cli/cobolx-cli/src/commands/bench.ts +47 -0
  48. package/cli/cobolx-cli/src/commands/build.ts +74 -0
  49. package/cli/cobolx-cli/src/commands/check.ts +24 -0
  50. package/cli/cobolx-cli/src/commands/debug.ts +15 -0
  51. package/cli/cobolx-cli/src/commands/debug_rewind.ts +16 -0
  52. package/cli/cobolx-cli/src/commands/deploy.ts +18 -0
  53. package/cli/cobolx-cli/src/commands/dev.ts +24 -0
  54. package/cli/cobolx-cli/src/commands/doc.ts +19 -0
  55. package/cli/cobolx-cli/src/commands/fmt.ts +14 -0
  56. package/cli/cobolx-cli/src/commands/fuzz.ts +24 -0
  57. package/cli/cobolx-cli/src/commands/generate.ts +38 -0
  58. package/cli/cobolx-cli/src/commands/install.ts +25 -0
  59. package/cli/cobolx-cli/src/commands/legacy.ts +17 -0
  60. package/cli/cobolx-cli/src/commands/lint.ts +17 -0
  61. package/cli/cobolx-cli/src/commands/migrate.ts +27 -0
  62. package/cli/cobolx-cli/src/commands/new.ts +20 -0
  63. package/cli/cobolx-cli/src/commands/profile.ts +8 -0
  64. package/cli/cobolx-cli/src/commands/publish.ts +16 -0
  65. package/cli/cobolx-cli/src/commands/repl.ts +30 -0
  66. package/cli/cobolx-cli/src/commands/run.ts +22 -0
  67. package/cli/cobolx-cli/src/commands/task.ts +27 -0
  68. package/cli/cobolx-cli/src/commands/test.ts +44 -0
  69. package/cli/cobolx-cli/src/commands/update.ts +30 -0
  70. package/cli/cobolx-cli/src/commands/visualize.ts +25 -0
  71. package/cli/cobolx-cli/src/index.ts +101 -0
  72. package/cli/cobolx-cli/src/project.ts +74 -0
  73. package/cli/cobolx-cli/tsconfig.json +7 -0
  74. package/cobolx.toml +7 -0
  75. package/compiler/package.json +14 -0
  76. package/compiler/src/ast/types.d.ts +87 -0
  77. package/compiler/src/ast/types.js +2 -0
  78. package/compiler/src/ast/types.js.map +1 -0
  79. package/compiler/src/ast/types.ts +329 -0
  80. package/compiler/src/backend/custom.d.ts +8 -0
  81. package/compiler/src/backend/custom.js +12 -0
  82. package/compiler/src/backend/custom.js.map +1 -0
  83. package/compiler/src/backend/custom.ts +21 -0
  84. package/compiler/src/borrow_checker/checker.d.ts +3 -0
  85. package/compiler/src/borrow_checker/checker.js +82 -0
  86. package/compiler/src/borrow_checker/checker.js.map +1 -0
  87. package/compiler/src/borrow_checker/checker.ts +100 -0
  88. package/compiler/src/codegen/javascript.d.ts +2 -0
  89. package/compiler/src/codegen/javascript.js +89 -0
  90. package/compiler/src/codegen/javascript.js.map +1 -0
  91. package/compiler/src/codegen/javascript.ts +175 -0
  92. package/compiler/src/const_eval/evaluator.ts +58 -0
  93. package/compiler/src/diagnostics.d.ts +11 -0
  94. package/compiler/src/diagnostics.js +14 -0
  95. package/compiler/src/diagnostics.js.map +1 -0
  96. package/compiler/src/diagnostics.ts +20 -0
  97. package/compiler/src/hir/lower.d.ts +7 -0
  98. package/compiler/src/hir/lower.js +44 -0
  99. package/compiler/src/hir/lower.js.map +1 -0
  100. package/compiler/src/hir/lower.ts +60 -0
  101. package/compiler/src/hir/types.d.ts +21 -0
  102. package/compiler/src/hir/types.js +2 -0
  103. package/compiler/src/hir/types.js.map +1 -0
  104. package/compiler/src/hir/types.ts +26 -0
  105. package/compiler/src/index.d.ts +22 -0
  106. package/compiler/src/index.js +84 -0
  107. package/compiler/src/index.js.map +1 -0
  108. package/compiler/src/index.ts +122 -0
  109. package/compiler/src/lexer/lexer.d.ts +21 -0
  110. package/compiler/src/lexer/lexer.js +207 -0
  111. package/compiler/src/lexer/lexer.js.map +1 -0
  112. package/compiler/src/lexer/lexer.ts +274 -0
  113. package/compiler/src/lexer/tokens.d.ts +8 -0
  114. package/compiler/src/lexer/tokens.js +18 -0
  115. package/compiler/src/lexer/tokens.js.map +1 -0
  116. package/compiler/src/lexer/tokens.ts +126 -0
  117. package/compiler/src/macros/expand.ts +75 -0
  118. package/compiler/src/main.ts +4 -0
  119. package/compiler/src/mir/lower.d.ts +3 -0
  120. package/compiler/src/mir/lower.js +10 -0
  121. package/compiler/src/mir/lower.js.map +1 -0
  122. package/compiler/src/mir/lower.ts +12 -0
  123. package/compiler/src/mir/types.d.ts +13 -0
  124. package/compiler/src/mir/types.js +2 -0
  125. package/compiler/src/mir/types.js.map +1 -0
  126. package/compiler/src/mir/types.ts +16 -0
  127. package/compiler/src/optimizer/constantFold.d.ts +2 -0
  128. package/compiler/src/optimizer/constantFold.js +61 -0
  129. package/compiler/src/optimizer/constantFold.js.map +1 -0
  130. package/compiler/src/optimizer/constantFold.ts +109 -0
  131. package/compiler/src/parser/parser.d.ts +33 -0
  132. package/compiler/src/parser/parser.js +323 -0
  133. package/compiler/src/parser/parser.js.map +1 -0
  134. package/compiler/src/parser/parser.ts +710 -0
  135. package/compiler/src/plugins/api.ts +8 -0
  136. package/compiler/src/plugins/loader.ts +21 -0
  137. package/compiler/src/semantic/analyzer.d.ts +12 -0
  138. package/compiler/src/semantic/analyzer.js +144 -0
  139. package/compiler/src/semantic/analyzer.js.map +1 -0
  140. package/compiler/src/semantic/analyzer.ts +277 -0
  141. package/compiler/src/type_system/checker.d.ts +7 -0
  142. package/compiler/src/type_system/checker.js +84 -0
  143. package/compiler/src/type_system/checker.js.map +1 -0
  144. package/compiler/src/type_system/checker.ts +108 -0
  145. package/compiler/tsconfig.json +7 -0
  146. package/debugger/package.json +11 -0
  147. package/debugger/src/index.d.ts +1 -0
  148. package/debugger/src/index.js +9 -0
  149. package/debugger/src/index.js.map +1 -0
  150. package/debugger/src/index.ts +9 -0
  151. package/debugger/tsconfig.json +7 -0
  152. package/docs/CHANGELOG.md +11 -0
  153. package/docs/CONTRIBUTING.md +15 -0
  154. package/docs/LICENSE +21 -0
  155. package/docs/architecture.md +29 -0
  156. package/docs/cli.md +58 -0
  157. package/docs/language-spec.md +49 -0
  158. package/docs/packages.md +19 -0
  159. package/docs/platform-systems.md +31 -0
  160. package/docs/release-validation.md +22 -0
  161. package/docs/runtime.md +10 -0
  162. package/docs/tooling.md +17 -0
  163. package/docs/vscode-extension.md +40 -0
  164. package/enterprise-demo/CargoX.lock +2 -0
  165. package/enterprise-demo/README.md +3 -0
  166. package/enterprise-demo/benchmarks/arith.cbx +6 -0
  167. package/enterprise-demo/cobolx.toml +7 -0
  168. package/enterprise-demo/src/main.cbx +5 -0
  169. package/enterprise-demo/tests/smoke.cbx +6 -0
  170. package/examples/README.md +20 -0
  171. package/examples/actors-and-flags.md +8 -0
  172. package/examples/api-server/README.md +9 -0
  173. package/examples/api-server/cobolx.toml +6 -0
  174. package/examples/api-server/src/main.cbx +8 -0
  175. package/examples/debug-replay.md +7 -0
  176. package/examples/debugging-demo/README.md +3 -0
  177. package/examples/debugging-demo/cobolx.toml +6 -0
  178. package/examples/debugging-demo/src/main.cbx +7 -0
  179. package/examples/distributed-service.md +12 -0
  180. package/examples/distributed-system/README.md +3 -0
  181. package/examples/distributed-system/cobolx.toml +6 -0
  182. package/examples/distributed-system/generated/deploy.json +12 -0
  183. package/examples/distributed-system/src/main.cbx +6 -0
  184. package/examples/event-driven.md +5 -0
  185. package/examples/event-system/README.md +3 -0
  186. package/examples/event-system/cobolx.toml +6 -0
  187. package/examples/event-system/src/main.cbx +11 -0
  188. package/examples/functions.cbx +10 -0
  189. package/examples/functions.mjs +12 -0
  190. package/examples/hello.cbx +5 -0
  191. package/examples/hello.mjs +7 -0
  192. package/examples/legacy-sample.cob +5 -0
  193. package/examples/parallel-processing/README.md +3 -0
  194. package/examples/parallel-processing/cobolx.toml +6 -0
  195. package/examples/parallel-processing/src/main.cbx +6 -0
  196. package/examples/parallel-processing.md +8 -0
  197. package/examples/platform-features.cbx +32 -0
  198. package/examples/platform-features.mjs +35 -0
  199. package/examples/service.cbx +10 -0
  200. package/examples/workflow-engine/README.md +3 -0
  201. package/examples/workflow-engine/cobolx.toml +6 -0
  202. package/examples/workflow-engine/generated/flowchart.mmd +8 -0
  203. package/examples/workflow-engine/src/main.cbx +13 -0
  204. package/examples/workflow-engine.md +5 -0
  205. package/formatter/package.json +14 -0
  206. package/formatter/src/index.d.ts +1 -0
  207. package/formatter/src/index.js +59 -0
  208. package/formatter/src/index.js.map +1 -0
  209. package/formatter/src/index.ts +103 -0
  210. package/formatter/tsconfig.json +7 -0
  211. package/generated/LEGACYDEMO.cbx +5 -0
  212. package/install.ps1 +4 -0
  213. package/install.sh +5 -0
  214. package/linter/package.json +14 -0
  215. package/linter/src/index.d.ts +2 -0
  216. package/linter/src/index.js +18 -0
  217. package/linter/src/index.js.map +1 -0
  218. package/linter/src/index.ts +19 -0
  219. package/linter/tsconfig.json +7 -0
  220. package/lsp/server/package.json +16 -0
  221. package/lsp/server/src/index.ts +168 -0
  222. package/lsp/server/tsconfig.json +7 -0
  223. package/package.json +30 -0
  224. package/profiler/package.json +11 -0
  225. package/profiler/src/index.d.ts +5 -0
  226. package/profiler/src/index.js +11 -0
  227. package/profiler/src/index.js.map +1 -0
  228. package/profiler/src/index.ts +11 -0
  229. package/profiler/tsconfig.json +7 -0
  230. package/release.json +10 -0
  231. package/runtime/package.json +14 -0
  232. package/runtime/src/actors/index.ts +27 -0
  233. package/runtime/src/async/futures.ts +11 -0
  234. package/runtime/src/code_as_data/index.ts +5 -0
  235. package/runtime/src/config/index.ts +17 -0
  236. package/runtime/src/distributed/index.ts +13 -0
  237. package/runtime/src/events/index.ts +21 -0
  238. package/runtime/src/feature_flags/index.ts +9 -0
  239. package/runtime/src/gc_or_arc/index.ts +1 -0
  240. package/runtime/src/healing/index.ts +26 -0
  241. package/runtime/src/index.ts +20 -0
  242. package/runtime/src/intents/index.ts +9 -0
  243. package/runtime/src/iterators/index.ts +23 -0
  244. package/runtime/src/memory/arc.ts +22 -0
  245. package/runtime/src/observability/index.ts +23 -0
  246. package/runtime/src/repl/context.ts +7 -0
  247. package/runtime/src/scheduler/taskScheduler.ts +11 -0
  248. package/runtime/src/security/capabilities.ts +15 -0
  249. package/runtime/src/security/secrets.ts +13 -0
  250. package/runtime/src/state/versioned.ts +31 -0
  251. package/runtime/src/std_hooks/audit.ts +23 -0
  252. package/runtime/src/time_travel/index.ts +54 -0
  253. package/runtime/src/workflows/index.ts +35 -0
  254. package/runtime/tsconfig.json +7 -0
  255. package/sample-payroll/README.md +3 -0
  256. package/sample-payroll/cobolx.toml +3 -0
  257. package/sample-payroll/src/main.cbx +5 -0
  258. package/stdlib/business/index.js +15 -0
  259. package/stdlib/core/README.md +8 -0
  260. package/stdlib/core/runtime.js +191 -0
  261. package/stdlib/crypto/index.js +5 -0
  262. package/stdlib/datetime/index.js +3 -0
  263. package/stdlib/fs/index.js +9 -0
  264. package/stdlib/http/index.js +7 -0
  265. package/stdlib/io/index.js +1 -0
  266. package/stdlib/json/index.js +7 -0
  267. package/stdlib/net/index.js +4 -0
  268. package/tests/macros.cbx +10 -0
  269. package/tests/pattern_match.cbx +16 -0
  270. package/tests/smoke.cbx +7 -0
  271. package/tests/validate-release.mjs +54 -0
  272. package/tsconfig.base.json +24 -0
  273. package/vscode-extension/LICENSE +21 -0
  274. package/vscode-extension/README.md +47 -0
  275. package/vscode-extension/cobolx-1.2.0.vsix +0 -0
  276. package/vscode-extension/icon.png +0 -0
  277. package/vscode-extension/icon.svg +15 -0
  278. package/vscode-extension/language-configuration.json +17 -0
  279. package/vscode-extension/package.json +148 -0
  280. package/vscode-extension/snippets/cobolx.code-snippets +49 -0
  281. package/vscode-extension/src/extension.ts +283 -0
  282. package/vscode-extension/syntaxes/cobolx.tmLanguage.json +75 -0
  283. package/vscode-extension/tests/test.cbl +3 -0
  284. package/vscode-extension/tsconfig.json +7 -0
@@ -0,0 +1,108 @@
1
+ import type { BinaryExpressionNode, ExpressionNode, ProgramNode, StatementNode } from "../ast/types.js";
2
+ import type { Diagnostic } from "../diagnostics.js";
3
+ import type { CobolxType } from "../hir/types.js";
4
+
5
+ interface Scope {
6
+ values: Map<string, CobolxType>;
7
+ parent?: Scope;
8
+ }
9
+
10
+ function lookup(scope: Scope, name: string): CobolxType | undefined {
11
+ return scope.values.get(name) ?? scope.parent?.values.get(name) ?? (scope.parent ? lookup(scope.parent, name) : undefined);
12
+ }
13
+
14
+ function inferExpression(expression: ExpressionNode, scope: Scope, diagnostics: Diagnostic[]): CobolxType {
15
+ switch (expression.kind) {
16
+ case "NumberLiteral":
17
+ return "number";
18
+ case "StringLiteral":
19
+ return "string";
20
+ case "BooleanLiteral":
21
+ return "boolean";
22
+ case "Identifier":
23
+ return lookup(scope, expression.name) ?? "unknown";
24
+ case "UnaryExpression":
25
+ return inferExpression(expression.operand, scope, diagnostics);
26
+ case "TryExpression":
27
+ return inferExpression(expression.expression, scope, diagnostics);
28
+ case "MemberExpression":
29
+ return "unknown";
30
+ case "CallExpression":
31
+ case "MacroInvocation":
32
+ for (const arg of expression.args) inferExpression(arg, scope, diagnostics);
33
+ return "unknown";
34
+ case "EnumConstructorExpression":
35
+ for (const field of expression.fields) inferExpression(field, scope, diagnostics);
36
+ return "enum";
37
+ case "ArrayLiteral":
38
+ for (const item of expression.items) inferExpression(item, scope, diagnostics);
39
+ return "array";
40
+ case "BinaryExpression":
41
+ return inferBinaryExpression(expression, scope, diagnostics);
42
+ }
43
+ }
44
+
45
+ function inferBinaryExpression(expression: BinaryExpressionNode, scope: Scope, diagnostics: Diagnostic[]): CobolxType {
46
+ const left = inferExpression(expression.left, scope, diagnostics);
47
+ const right = inferExpression(expression.right, scope, diagnostics);
48
+ if (["+", "-", "*", "/", "%"].includes(expression.operator)) {
49
+ if (left !== "number" || right !== "number") {
50
+ diagnostics.push({ message: `Arithmetic operator '${expression.operator}' expects number operands`, severity: "warning", range: expression.range });
51
+ }
52
+ return "number";
53
+ }
54
+ if (["==", "!=", "<", "<=", ">", ">="].includes(expression.operator)) return "boolean";
55
+ return "unknown";
56
+ }
57
+
58
+ export function inferProgramTypes(program: ProgramNode): { symbolTypes: Record<string, CobolxType>; diagnostics: Diagnostic[] } {
59
+ const diagnostics: Diagnostic[] = [];
60
+ const scope: Scope = { values: new Map() };
61
+ for (const constant of program.consts) scope.values.set(constant.name, inferExpression(constant.expression, scope, diagnostics));
62
+
63
+ const visitStatements = (statements: StatementNode[], localScope: Scope): void => {
64
+ for (const statement of statements) {
65
+ switch (statement.kind) {
66
+ case "LetStatement":
67
+ localScope.values.set(statement.binding.name, inferExpression(statement.expression, localScope, diagnostics));
68
+ break;
69
+ case "SetStatement":
70
+ localScope.values.set(statement.name, inferExpression(statement.expression, localScope, diagnostics));
71
+ break;
72
+ case "InputStatement":
73
+ localScope.values.set(statement.name, "string");
74
+ if (statement.prompt) inferExpression(statement.prompt, localScope, diagnostics);
75
+ break;
76
+ case "DisplayStatement":
77
+ case "ExpressionStatement":
78
+ case "ReturnStatement":
79
+ case "AssertStatement":
80
+ case "SpawnStatement":
81
+ inferExpression(statement.expression, localScope, diagnostics);
82
+ break;
83
+ case "IfStatement":
84
+ inferExpression(statement.condition, localScope, diagnostics);
85
+ visitStatements(statement.thenBranch, { values: new Map(localScope.values), parent: localScope.parent });
86
+ visitStatements(statement.elseBranch, { values: new Map(localScope.values), parent: localScope.parent });
87
+ break;
88
+ case "MatchStatement":
89
+ inferExpression(statement.expression, localScope, diagnostics);
90
+ for (const arm of statement.arms) visitStatements(arm.body, { values: new Map(localScope.values), parent: localScope.parent });
91
+ break;
92
+ case "UnsafeBlock":
93
+ case "BlockStatement":
94
+ visitStatements(statement.body, { values: new Map(localScope.values), parent: localScope });
95
+ break;
96
+ }
97
+ }
98
+ };
99
+
100
+ for (const fn of program.functions) {
101
+ const fnScope: Scope = { values: new Map(), parent: scope };
102
+ for (const param of fn.signature.params) fnScope.values.set(param.name, param.typeName === "STRING" ? "string" : "unknown");
103
+ visitStatements(fn.body, fnScope);
104
+ }
105
+
106
+ visitStatements(program.body, scope);
107
+ return { symbolTypes: Object.fromEntries(scope.values.entries()), diagnostics };
108
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist"
5
+ },
6
+ "include": ["src/**/*.ts"]
7
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@cobolx/debugger",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "scripts": {
7
+ "build": "tsc -p tsconfig.json",
8
+ "check": "tsc -p tsconfig.json --noEmit",
9
+ "clean": "if (Test-Path dist) { Remove-Item -Recurse -Force dist }"
10
+ }
11
+ }
@@ -0,0 +1 @@
1
+ export declare function debugNodeProgram(programPath: string): number;
@@ -0,0 +1,9 @@
1
+ import { spawnSync } from "node:child_process";
2
+ export function debugNodeProgram(programPath) {
3
+ console.log(`[debug] starting ${programPath}`);
4
+ const result = spawnSync(process.execPath, ["--inspect-brk=0", programPath], {
5
+ stdio: "inherit"
6
+ });
7
+ return result.status ?? 1;
8
+ }
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAAC,WAAmB;IAClD,OAAO,CAAC,GAAG,CAAC,oBAAoB,WAAW,EAAE,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,iBAAiB,EAAE,WAAW,CAAC,EAAE;QAC3E,KAAK,EAAE,SAAS;KACjB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { spawnSync } from "node:child_process";
2
+
3
+ export function debugNodeProgram(programPath: string): number {
4
+ console.log(`[debug] starting ${programPath}`);
5
+ const result = spawnSync(process.execPath, ["--inspect-brk=0", programPath], {
6
+ stdio: "inherit"
7
+ });
8
+ return result.status ?? 1;
9
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist"
5
+ },
6
+ "include": ["src/**/*.ts"]
7
+ }
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0
4
+
5
+ - Expanded COBOLX into a multi-workspace ecosystem with runtime, package management, formatter, linter, debugger, and profiler packages
6
+ - Added compiler phase separation for HIR, MIR, type checking, borrow analysis, optimizer, and backend generation
7
+ - Added GitHub-ready documentation and repository metadata
8
+
9
+ ## 0.1.0
10
+
11
+ - Initial TypeScript compiler, CLI, LSP, and VS Code extension
@@ -0,0 +1,15 @@
1
+ # Contributing
2
+
3
+ ## Workflow
4
+
5
+ 1. Install dependencies with `npm install`.
6
+ 2. Build all workspaces with `npm run build`.
7
+ 3. Verify changes with `npm run check`, `npm run test`, and targeted CLI commands.
8
+ 4. Keep documentation in sync with behavior.
9
+
10
+ ## Standards
11
+
12
+ - Prefer small, reviewable changes.
13
+ - Add tests or runnable examples for language features and tools.
14
+ - Keep compiler phases isolated by responsibility.
15
+ - Avoid introducing undocumented syntax.
package/docs/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 COBOLX
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.
@@ -0,0 +1,29 @@
1
+ # COBOL-X Architecture
2
+
3
+ ## Compiler
4
+
5
+ - `lexer`: tokenization and source ranges
6
+ - `parser`: AST construction
7
+ - `semantic`: name and control-flow oriented validation
8
+ - `type_system`: basic type inference for literals and arithmetic expressions
9
+ - `hir`: semantic lowering stage
10
+ - `borrow_checker`: mutating alias checks across calls
11
+ - `mir`: instruction-oriented lowering stage
12
+ - `optimizer`: constant folding
13
+ - `backend`: custom JavaScript backend
14
+
15
+ ## Toolchain
16
+
17
+ - `cargox`: manifest parsing, lockfile generation, dependency graph resolution, local registry publishing
18
+ - `cli/cobolx-cli`: user-facing command surface
19
+ - `formatter`, `linter`, `debugger`, `profiler`: standalone toolchain packages integrated into the CLI
20
+
21
+ ## Runtime and Stdlib
22
+
23
+ - `runtime`: ARC-style references, futures, scheduling, and audit hooks
24
+ - `stdlib`: IO, filesystem, network, HTTP, JSON, crypto, datetime, and business modules
25
+
26
+ ## Editor Support
27
+
28
+ - `lsp/server`: diagnostics, hover, and completion
29
+ - `vscode-extension`: syntax grammar, snippets, and LSP client wiring
package/docs/cli.md ADDED
@@ -0,0 +1,58 @@
1
+ # COBOL-X CLI
2
+
3
+ ## Commands
4
+
5
+ - `cobolx new my-project`
6
+ - `cobolx build`
7
+ - `cobolx run`
8
+ - `cobolx check`
9
+ - `cobolx test`
10
+ - `cobolx bench`
11
+ - `cobolx add dependency 1.0.0`
12
+ - `cobolx install`
13
+ - `cobolx update`
14
+ - `cobolx publish`
15
+ - `cobolx fmt`
16
+ - `cobolx lint`
17
+ - `cobolx debug`
18
+ - `cobolx profile`
19
+ - `cobolx dev`
20
+ - `cobolx doc`
21
+ - `cobolx repl`
22
+ - `cobolx visualize`
23
+ - `cobolx deploy`
24
+
25
+ ## Project Layout
26
+
27
+ ```text
28
+ my-project/
29
+ ├── src/
30
+ │ └── main.cbx
31
+ ├── cobolx.toml
32
+ └── README.md
33
+ ```
34
+
35
+ ## Config
36
+
37
+ `cobolx.toml` uses a package/dependency layout:
38
+
39
+ ```toml
40
+ [package]
41
+ name = "my-project"
42
+ version = "0.1.0"
43
+ entry = "src/main.cbx"
44
+
45
+ [dependencies]
46
+ ```
47
+
48
+ Build output is written to `dist/main.mjs`.
49
+
50
+ ## Validation Flow
51
+
52
+ Typical release validation:
53
+
54
+ ```powershell
55
+ npm run build
56
+ npm run test
57
+ npm run validate
58
+ ```
@@ -0,0 +1,49 @@
1
+ # COBOL-X Language Specification
2
+
3
+ ## File Format
4
+
5
+ COBOL-X source files use the `.cbx` extension.
6
+
7
+ ## Program Structure
8
+
9
+ Every file starts with a `PROGRAM` declaration followed by a `BEGIN`/`END` block.
10
+
11
+ ```cbx
12
+ PROGRAM Sample
13
+
14
+ BEGIN
15
+ DISPLAY "Hello"
16
+ END
17
+ ```
18
+
19
+ ## Statements
20
+
21
+ - `SET name = expression`
22
+ - `DISPLAY expression`
23
+ - `INPUT name`
24
+ - `IF expression THEN ... ELSE ... END-IF`
25
+ - `FUNCTION name(param, other) BEGIN ... END-FUNCTION`
26
+ - `RETURN expression`
27
+
28
+ ## Expressions
29
+
30
+ - Numbers: `42`, `3.14`
31
+ - Strings: `"hello"`
32
+ - Booleans: `TRUE`, `FALSE`
33
+ - Variables: `salary`
34
+ - Arithmetic: `+`, `-`, `*`, `/`
35
+ - Comparison: `=`, `!=`, `<`, `<=`, `>`, `>=`
36
+ - Calls: `compute_tax(salary)`
37
+
38
+ ## Semantics
39
+
40
+ - Variables must be assigned before they are read.
41
+ - Functions must be declared before they are called.
42
+ - Duplicate function names are rejected.
43
+ - Function argument counts are checked.
44
+ - Arithmetic diagnostics are emitted when non-numeric values are used in numeric operators.
45
+ - Borrow-style alias diagnostics reject passing the same identifier repeatedly to mutating functions.
46
+
47
+ ## Code Generation
48
+
49
+ The compiler lowers source through HIR and MIR, performs constant folding, and emits JavaScript through the custom backend.
@@ -0,0 +1,19 @@
1
+ # CargoX Packages
2
+
3
+ Implemented CargoX features in this repository:
4
+
5
+ - Manifest parsing from `cobolx.toml`
6
+ - Dependency graph resolution
7
+ - Lockfile writing to `CargoX.lock`
8
+ - Install materialization into `.cargox/packages/`
9
+ - Dependency update flow with manifest rewrite + lockfile refresh
10
+ - Local package publishing to `.cargox-registry/`
11
+
12
+ The current implementation is intentionally local-first and workspace-friendly.
13
+
14
+ Core commands:
15
+
16
+ - `cobolx add ledger 1.2.3`
17
+ - `cobolx install`
18
+ - `cobolx update`
19
+ - `cobolx publish`
@@ -0,0 +1,31 @@
1
+ # COBOL-X Platform Systems
2
+
3
+ This repository now includes working foundations for:
4
+
5
+ 1. Effect-oriented compiler evolution groundwork through compiler metadata and plugin hooks
6
+ 2. Capability-based runtime security types in `runtime/src/security`
7
+ 3. Hot reload via `cobolx dev`
8
+ 4. Typed configuration via `runtime/src/config`
9
+ 5. Migrations via `cobolx migrate create|run`
10
+ 6. Observability via `runtime/src/observability`
11
+ 7. Feature flags via `runtime/src/feature_flags`
12
+ 8. Version-ready API scaffolding via `cobolx generate api`
13
+ 9. Actor model primitives via `runtime/src/actors`
14
+ 10. Shared client type generation via `cobolx generate client typescript`
15
+ 11. Task pipeline automation via `cobolx task`
16
+ 12. Fuzz testing via `cobolx fuzz`
17
+ 13. Secret management via `runtime/src/security/secrets`
18
+ 14. DSL evolution hooks through macros, plugins, and code generation entry points
19
+ 15. Distributed tooling via `runtime/src/distributed`
20
+ 16. Build caching and incremental reuse in `cobolx build`
21
+ 17. Interactive REPL via `cobolx repl`
22
+ 18. Code generation via `cobolx generate`
23
+ 19. Legacy COBOL conversion via `cobolx legacy`
24
+ 20. Project templates via `cobolx new <name> [api|microservice|cli]`
25
+ 21. Time-travel debugging via `runtime/src/time_travel` and `cobolx debug --rewind`
26
+ 22. Event bus support via `runtime/src/events`
27
+ 23. Workflow execution via `runtime/src/workflows`
28
+ 24. Self-healing supervisor and health checks via `runtime/src/healing`
29
+ 25. Versioned state tracking via `runtime/src/state/versioned`
30
+ 26. Visual flow generation via `cobolx visualize`
31
+ 27. Deploy metadata and distributed registration via `cobolx deploy`
@@ -0,0 +1,22 @@
1
+ # Release Validation
2
+
3
+ The repository includes a scripted validation pass in [tests/validate-release.mjs](/c:/Users/matth/Desktop/temp%20folder/tests/validate-release.mjs:1).
4
+
5
+ It verifies:
6
+
7
+ - workspace build
8
+ - compiler-backed tests
9
+ - benchmark execution
10
+ - project scaffolding
11
+ - package add/install/update
12
+ - docs generation
13
+ - migrations
14
+ - visualization
15
+ - deploy metadata
16
+ - debug trace rewind
17
+
18
+ Run it with:
19
+
20
+ ```powershell
21
+ npm run validate
22
+ ```
@@ -0,0 +1,10 @@
1
+ # COBOL-X Runtime
2
+
3
+ The runtime package provides:
4
+
5
+ - `ArcBox<T>` for deterministic shared ownership semantics
6
+ - `TaskScheduler` for cooperative async execution
7
+ - `futureOf()` for future-style wrappers
8
+ - `audit()` and `getAuditTrail()` for enterprise audit hooks
9
+
10
+ These modules are intentionally small and composable so services can build deterministic infrastructure behavior on top of them.
@@ -0,0 +1,17 @@
1
+ # COBOL-X Tooling
2
+
3
+ ## Formatter
4
+
5
+ `@cobolx/formatter` parses and prints canonical `.cbx` source.
6
+
7
+ ## Linter
8
+
9
+ `@cobolx/linter` combines compiler diagnostics with style warnings like lowercase keyword usage.
10
+
11
+ ## Debugger
12
+
13
+ `@cobolx/debugger` launches Node inspection against compiled output.
14
+
15
+ ## Profiler
16
+
17
+ `@cobolx/profiler` measures build and run phases used by `cobolx bench` and `cobolx profile`.
@@ -0,0 +1,40 @@
1
+ # VS Code Extension
2
+
3
+ The COBOL-X VS Code extension lives in [vscode-extension](/c:/Users/matth/Desktop/temp%20folder/vscode-extension:1).
4
+
5
+ ## Included Features
6
+
7
+ - Language registration for `cobolx`
8
+ - File associations for `.cbx`, `.cob`, and `.col`
9
+ - TextMate grammar for syntax highlighting
10
+ - Snippets for programs, functions, enums, and match blocks
11
+ - Language client integration with the local COBOL-X language server
12
+ - Commands for build, run, REPL, and basic debug launch
13
+
14
+ Command routing:
15
+
16
+ - In the COBOL-X monorepo, the extension uses the local `cli/cobolx-cli/dist/index.js`
17
+ - In standalone projects, it falls back to `cobolx` on the system `PATH`
18
+
19
+ ## Local Testing
20
+
21
+ 1. Run `npm install`
22
+ 2. Run `npm run build`
23
+ 3. Open the repo in VS Code
24
+ 4. Press `F5` to launch an Extension Development Host
25
+ 5. Open a `.cbx` file and confirm syntax coloring, hover text, diagnostics, and command palette entries
26
+
27
+ ## Marketplace Packaging
28
+
29
+ ```powershell
30
+ cd vscode-extension
31
+ npm install -g vsce
32
+ npx @vscode/vsce package
33
+ ```
34
+
35
+ ## Publishing
36
+
37
+ ```powershell
38
+ vsce login Magnexis
39
+ vsce publish
40
+ ```
@@ -0,0 +1,2 @@
1
+ workspace = "enterprise-demo"
2
+ ledger = "1.2.0"
@@ -0,0 +1,3 @@
1
+ # enterprise-demo
2
+
3
+ Generated with COBOL-X.
@@ -0,0 +1,6 @@
1
+ PROGRAM Bench
2
+
3
+ BEGIN
4
+ SET value = 1000 * 1000
5
+ DISPLAY value
6
+ END
@@ -0,0 +1,7 @@
1
+ [package]
2
+ name = "enterprise-demo"
3
+ version = "0.1.0"
4
+ entry = "src/main.cbx"
5
+
6
+ [dependencies]
7
+ ledger = "1.2.0"
@@ -0,0 +1,5 @@
1
+ PROGRAM enterprisedemo
2
+
3
+ BEGIN
4
+ DISPLAY "Hello from COBOL-X"
5
+ END
@@ -0,0 +1,6 @@
1
+ PROGRAM Smoke
2
+
3
+ BEGIN
4
+ SET total = 1 + 2
5
+ DISPLAY total
6
+ END
@@ -0,0 +1,20 @@
1
+ # COBOL-X Examples
2
+
3
+ This directory contains runnable COBOL-X projects that exercise the CLI, compiler, runtime, and platform tooling.
4
+
5
+ Projects:
6
+
7
+ - `api-server/`
8
+ - `distributed-system/`
9
+ - `workflow-engine/`
10
+ - `event-system/`
11
+ - `parallel-processing/`
12
+ - `debugging-demo/`
13
+
14
+ Typical flow:
15
+
16
+ ```powershell
17
+ cd examples/api-server
18
+ node ..\..\cli\cobolx-cli\dist\index.js check
19
+ node ..\..\cli\cobolx-cli\dist\index.js run
20
+ ```
@@ -0,0 +1,8 @@
1
+ # Actors And Flags
2
+
3
+ This example is represented at the platform/runtime layer:
4
+
5
+ - Use `createActor("payments", handler)` from `@cobolx/runtime`
6
+ - Use `setFeatureFlag("new_checkout", true)` and `featureEnabled("new_checkout")`
7
+ - Use `log()`, `incrementMetric()`, and `trace()` for observability
8
+ - Use `registerService()` and `discoverService()` for distributed service lookup
@@ -0,0 +1,9 @@
1
+ # API Server Example
2
+
3
+ Demonstrates the API-oriented project template and documentation/code-generation flow.
4
+
5
+ Useful commands:
6
+
7
+ - `cobolx run`
8
+ - `cobolx generate api`
9
+ - `cobolx doc`
@@ -0,0 +1,6 @@
1
+ [package]
2
+ name = "api-server"
3
+ version = "1.0.0"
4
+ entry = "src/main.cbx"
5
+
6
+ [dependencies]
@@ -0,0 +1,8 @@
1
+ PROGRAM ApiServer
2
+
3
+ CONST VERSION = "v1"
4
+
5
+ BEGIN
6
+ DISPLAY "API server boot"
7
+ DISPLAY VERSION
8
+ END
@@ -0,0 +1,7 @@
1
+ # Debug Replay
2
+
3
+ 1. Run a project with `cobolx run`
4
+ 2. COBOL-X writes `dist/debug-timeline.json`
5
+ 3. Replay history with `cobolx debug --rewind`
6
+
7
+ This uses the runtime time-travel debugger and recorded state snapshots.
@@ -0,0 +1,3 @@
1
+ # Debugging Demo
2
+
3
+ Run `cobolx run` and then `cobolx debug --rewind` to inspect the recorded execution timeline.
@@ -0,0 +1,6 @@
1
+ [package]
2
+ name = "debugging-demo"
3
+ version = "1.0.0"
4
+ entry = "src/main.cbx"
5
+
6
+ [dependencies]
@@ -0,0 +1,7 @@
1
+ PROGRAM DebuggingDemo
2
+
3
+ BEGIN
4
+ SET account = 100
5
+ SET account = account + 50
6
+ DISPLAY account
7
+ END
@@ -0,0 +1,12 @@
1
+ # Distributed Service
2
+
3
+ Use the runtime distributed registry:
4
+
5
+ ```ts
6
+ import { registerService, discoverService } from "@cobolx/runtime";
7
+
8
+ registerService("payments", "node://payments");
9
+ console.log(discoverService("payments"));
10
+ ```
11
+
12
+ The CLI `cobolx deploy` writes deployment metadata and service discovery output.
@@ -0,0 +1,3 @@
1
+ # Distributed System Example
2
+
3
+ Demonstrates the distributed deployment flow with `cobolx deploy`.
@@ -0,0 +1,6 @@
1
+ [package]
2
+ name = "distributed-system"
3
+ version = "1.0.0"
4
+ entry = "src/main.cbx"
5
+
6
+ [dependencies]