makrellts
v0.10.0
Published
TypeScript implementation of the Makrell language family, including MakrellTS, browser tooling, and MRTD helpers.
Maintainers
Readme
MakrellTS
impl/ts is the TypeScript reference implementation for Makrell.
Targets:
- Bun (preferred) and Node.js
- Browser runtime (including isolated meta execution support)
Website and documentation: makrell.dev
Current editor workflow: ../../vscode-makrell/README.md
Install
bun add -g makrelltsThe published CLI/build story is Bun-first.
Run a script:
makrellts hello.mrtsEmit generated JS:
makrellts hello.mrts --emit-jsCheck a file and emit machine-readable diagnostics:
makrellts check hello.mrts --jsonPublished package shape:
- library entry:
makrellts - browser entry:
makrellts/browser - shared editor assets:
makrellts/editor-assets - playground launch examples:
makrellts/playground - CLI entry:
makrellts
For the current browser-facing product direction, see
https://makrell.dev/playground/.
Contributor commands
cd impl/ts
bun install
bun run build
bun run build:browser
bun run test
bun run typecheck
bun run lint
bun run test:browser
bun run ciTyped outputs (API):
import { compileToTs, compileToDts } from "makrellts";Shared editor assets (for browser tooling, playground work, or editor reuse):
import { getMakrellEditorAssets, makrellEditorLanguages } from "makrellts/editor-assets";Playground launch examples (generated from real checked-in .mrts sources):
import { getMakrellPlaygroundExample, makrellPlaygroundExamples } from "makrellts/playground";Async execution:
import { runAsync } from "makrellts";MakrellTS by example
Core syntax
a = 2
b = a + 3
[a b 5] | sum
{fun add [x y]
x + y}
{if a < b
"a is less"
"a is not less"}
{match a
2 "two"
_ "other"}TypeScript-oriented semantics
Point = {class Point
{fun __init__ [self x:number y:number]
self.x = x
self.y = y}
}
p:Point = {new Point [2 3]}
mode:"option1" | "option2" = "option1"Macros and meta execution
{def macro twice [x]
[{quote $x} {quote $x}]}
{twice {print "hello"}}Macro showcase:
examples/macros/showcase.mrts- includes
pipe,rpn, andlisp - intended as the compact shared macro trio for
v0.10.0 - now matches the current MakrellPy / Makrell# showcase results for the shared
pipe/rpn/lispexamples
Async/await
{async fun addLater [x y]
left = {await {Promise.resolve x}}
right = {await {Promise.resolve y}}
left + right
}
{await {addLater 20 22}}API:
import { runAsync } from "makrellts";
const result = await runAsync(`
{async fun addLater [x y]
left = {await {Promise.resolve x}}
right = {await {Promise.resolve y}}
left + right
}
{await {addLater 20 22}}
`);Checked-in example:
examples/async/await.mrts
MRON example
owner "Rena Holm"
active true
count 3
items [
{ name "A" }
{ name "B" }
]MRML example
{html
{body
{h1 MakrellTS}
{p Generated from MBF-style syntax.}
}
}MRTD example
name:string age:int active:bool
Ada 32 true
"Rena Holm" 29 falseAPI:
import { parseMrtd, readMrtdRecords, readMrtdTuples, writeMrtdRecords } from "makrellts";
const doc = parseMrtd(`
name:string age:int active:bool
Ada 32 true
Ben 41 false
`);Profile example:
const profileDoc = parseMrtd(`
when bonus
"2026-04-03"dt 3k
`, { profiles: ["extended-scalars"] });Layout
src/: compiler/runtime sourcesrc/browser.ts: browser compile/execute entrypointsrc/editor_assets.ts: exported synced editor-language metadata for playground/editor reusesrc/meta_worker.ts: browser meta worker entrypointsrc/playground.ts: exported launch-example manifest for browser/playground reusesrc/browser-runtime/: checked-in browser runtime JS for no-build static hostingtests/unit/: unit teststests/parity/: parity tests against MakrellPy behaviour where applicablescripts/: helper scripts (including browser smoke check)examples/: runnable examplesexamples/browser-smoke/index.htmlexamples/browser-compile/index.htmlexamples/nbody-browser/index.html
COMPATIBILITY.md: runtime/tooling support matrixIMPORT_MODEL.md: runtime/importm interoperability model (CJS/ESM/browser strategy)REFERENCE_PLAN.md: roadmap and milestone tracking
Notes
- Bun is the preferred local runtime.
- Node/browser support is tracked in
COMPATIBILITY.md. import/importmbehaviour and browser module loading strategy are defined inIMPORT_MODEL.md.- Browser runtime bundle outputs are built to
dist/browser/and mirrored insrc/browser-runtime/for static hosting without build steps. - Shared editor assets are synced from
../../shared/makrell-editor-assets/intosrc/editor-assets/viabun run sync:assets. - Playground launch examples are synced from real
.mrtssource files intosrc/generated/playground_examples.tsviabun run sync:playground. - N-body simulator example is at
examples/nbody-browser/index.htmland uses MakrellTS source (app.mrts). - For the current editor workflow across the family, see
../../vscode-makrell/README.md.
Licence
MIT. See ../../LICENSE.
