You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+78-13Lines changed: 78 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# MeTTa TS
2
2
3
-
A pure-TypeScript implementation of **MeTTa** (Meta Type Talk), the OpenCog Hyperon language. It runs anywhere TypeScript runs: the browser, Node, Deno, Bun, edge and serverless functions, and inside TypeScript-based AI agents. No native addons, no WASM, no Rust.
3
+
A pure-TypeScript implementation of **MeTTa** (Meta Type Talk), the OpenCog Hyperon language. The core engine runs anywhere TypeScript runs: the browser, Node, Deno, Bun, edge and serverless functions, and inside TypeScript-based AI agents. No native addons, no required WASM, no Rust.
4
4
5
5
<palign="center">
6
6
<imgsrc="website/public/recursion.gif"width="840"alt="The factorial (fact 5) reducing to 120, played side by side as a node graph and as nested blocks in MeTTaGrapher" />
@@ -21,7 +21,8 @@ Other packages, add as needed:
21
21
npm install @metta-ts/hyperon # a Python-hyperon-style class API
The Prolog surface follows PeTTa's `Predicate`, `callPredicate`, `prolog-call`,
218
+
and `import_prolog_function` forms where they are independent of PeTTa's own
219
+
evaluator. MeTTa TS does not add a PeTTa mode or a curry mode.
220
+
161
221
More runnable examples are in [`examples/`](examples/): [`quickstart.ts`](examples/quickstart.ts), [`grounded-ops.ts`](examples/grounded-ops.ts), [`async.ts`](examples/async.ts), [`edsl.ts`](examples/edsl.ts), plus `.metta` source files. Run one with `npx tsx examples/quickstart.ts`.
162
222
163
223
## Connecting to a Distributed AtomSpace
@@ -191,7 +251,10 @@ A faithful port of hyperon-experimental's minimal interpreter (the nondeterminis
191
251
192
252
Beyond the core: transactions, async evaluation, concurrency primitives (`par`, `race`, `once`, `hyperpose`, `with-mutex`), clause indexing that scales matching to millions of atoms, a flat interned knowledge base with a worker-thread parallel matcher, and a JavaScript interop layer (`js-atom`, `js-dot`, `js-list`, `js-dict`) that calls into the host runtime directly.
193
253
194
-
The whole thing is pure TypeScript. The core builds to a single ESM bundle (~23 KB gzipped) that runs in Node and the browser with no native addon and no WASM.
254
+
The language engine is pure TypeScript. The core builds to a single ESM bundle
255
+
(~23 KB gzipped) that runs in Node and the browser with no native addon and no
256
+
required WASM. Optional host adapters are separate packages: Pyodide and
257
+
SWI-WASM are only pulled into browser bundles that import their adapter subpaths.
|[`@metta-ts/core`](packages/core)| The interpreter, parser, type system, and standard library. Zero platform dependencies. |
271
+
|[`@metta-ts/hyperon`](packages/hyperon)| A TypeScript class API over the core, modeled on Python's `hyperon`. |
272
+
|[`@metta-ts/edsl`](packages/edsl)| An ergonomic, typed eDSL: term builders, special-form combinators, and a tagged template. |
273
+
|[`@metta-ts/node`](packages/node)| The `metta-ts` CLI, file `import!`, and a `SharedArrayBuffer` worker-thread parallel matcher. |
274
+
|[`@metta-ts/browser`](packages/browser)| Browser entry point with an in-memory virtual file system for `import!`. |
275
+
|[`@metta-ts/py`](packages/py)| Optional Python interop: PeTTa's `py-call` and Hyperon's `py-atom`, over pythonia or Pyodide. |
276
+
|[`@metta-ts/prolog`](packages/prolog)| Optional Prolog interop: PeTTa-compatible predicate calls over SWI-Prolog or SWI-WASM. |
277
+
|[`@metta-ts/das-client`](packages/das-client)| Optional client to SingularityNET's Distributed AtomSpace via a Connect gateway. |
214
278
215
279
## Performance
216
280
217
-
Pure TypeScript throughout, no escape to native code. The interpreter uses a precomputed-ground short-circuit, structural sharing in substitution, a cons-list instruction stack, and Prolog-style clause indexing (by head functor and by every ground-leaf argument position). A functor-and-argument-keyed query over a 1,000,000-atom knowledge base resolves in about 0.2 to 1.4 ms. See [`packages/node/bench/RESULTS.md`](packages/node/bench/RESULTS.md) for the full benchmark log.
281
+
The pure-MeTTa path stays TypeScript throughout, with no escape to native code. The interpreter uses a precomputed-ground short-circuit, structural sharing in substitution, a cons-list instruction stack, and Prolog-style clause indexing (by head functor and by every ground-leaf argument position). A functor-and-argument-keyed query over a 1,000,000-atom knowledge base resolves in about 0.2 to 1.4 ms. See [`packages/node/bench/RESULTS.md`](packages/node/bench/RESULTS.md) for the full benchmark log.
218
282
219
283
### Head-to-head with PeTTa
220
284
@@ -261,6 +325,7 @@ The last holdouts fell in order. `permutations` is a 28-relation conjunctive `(l
261
325
262
326
-**Semantics:**[hyperon-experimental](https://github.com/trueagi-io/hyperon-experimental), pinned to commit `3f76dc4`.
263
327
-**Verified spec and differential oracle:**[LeaTTa](https://github.com/MesTTo/LeaTTa) (Lean 4).
328
+
-**Host interop surfaces:** PeTTa-compatible Python and Prolog call forms where they do not depend on PeTTa's evaluator.
264
329
-**Distributed AtomSpace:** optional client to SingularityNET DAS via a Connect gateway (Node), reachable from the browser.
0 commit comments