IntentLang (IL) is an early experiment with a minimal parser, type checker and TypeScript transpiler.
@intentlang/core– parser, AST, checker and runtime helpers.@intentlang/cli– command‑line interfaceintentfor checking and building IL files.@intentlang/examples– canonical examples and golden tests.
- Install dependencies:
pnpm install
- Run the test and lint suites:
pnpm lint pnpm test pnpm -w typecheck - Build all packages:
pnpm -w build
uses { random: Random { } }
func add(a: Int, b: Int): Int
requires a >= 0 && b >= 0
ensures _ >= a && _ >= b
{ return a + b; }
test add_works { let r = random.int(); }
Iterate over a list with a for statement:
for x in [1, 2, 3] { }
intent can produce reproducible outputs by seeding its runtime:
pnpm --filter @intentlang/cli intent test file.il --seed-rng 1 --seed-clock 0
pnpm --filter @intentlang/cli intent build file.il --seed-rng 1 --seed-clock 0--seed-rng fixes the pseudo‑random generator; --seed-clock sets the initial
time returned by the runtime clock.
- Web (Docusaurus):
packages/docs→ runpnpm docs:startorpnpm docs:build. - Spec/PDF (LaTeX):
IntentLang-LaTex→ runlatexmk(uses LuaLaTeX).
Note: the legacy root docs/ folder is deprecated and kept for history. New content lives under packages/docs and the LaTeX spec includes sources directly from the repo.
- The Tree‑sitter grammar enforces syntactic purity for
pure_expr(noawait,throw, orspawn) in contexts likemeta.invariantsandrequires/ensures. - Optional chaining cannot be mixed with non‑optional chaining inside a single postfix chain (e.g.
a?.b.cis not allowed). - Operator precedence follows the canonical EBNF:
??binds looser than||, which binds looser than&&, then bitwise, equality, relational, shift, additive, and multiplicative. - Numeric tokens are unsigned; unary
-is parsed at the expression level.
To rebuild the parser WASM used by the VS Code extension:
pnpm --filter vscode-intentlang run build-parser