Skip to content
zeronshPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

248 Commits

Folders and files

Repository files navigation

Zlang

A statically typed, effect-inferred, embeddable application language. It aims for the simplicity of Lua, the algebraic effects of Koka, ML-style inference, and an engine designed for hot reload and near-native speed. It is implemented in Odin and designed for AI agents as first-class authors.

type User
    id: Int
    name: String
end

effect Users
    find(id: Int) -> User
end

fn greet(id)
    user = Users.find(id)
    "Hello, {user.name}"
end
-- zl sig:  fn greet : (Int) -> String ! {Users}

handler TestUsers: Users
    fn find(id) { id, name: "Ada" } end
end

fn main()
    print(handle greet(1) with TestUsers end)
end
  • Design: spec/zlang-design.md. It starts with a challenge register covering every assumption.
  • How to write Zlang: docs/idioms.md, also available as zl idioms.
  • What is implemented: docs/status.md. The current build is a bootstrap slice: front end, type and effect inference, the T0 reference evaluator, and the agent tooling.

Build and run

Requires the Odin compiler.

ODIN=odin ./build.sh
./bin/zl run examples/effects.zl
./bin/zl check examples/effects.zl --json    # structured diagnostics with fixes
./bin/zl sig examples/effects.zl             # inferred signatures, including effects
./bin/zl explain Z0307
tests/run.sh

For agents

The toolchain is built to be driven by agents (spec §13):

  • zl idioms prints the canonical style guide: one idiomatic form per construct.
  • zl check --json returns structured diagnostics with stable codes and exact fixes.
  • ? holes ask the compiler what fits at that point.
  • zl sig shows every inferred signature, including effects, which are the code's exact authority.
  • zl diff --git HEAD file.zl reviews what new authority a change grants.
  • zl run --allow Console --fuel N --max-memory 64M runs untrusted code safely.
  • zl run --trace t.jsonl records every input; zl run --replay t.jsonl reproduces the run exactly.
  • zl dis file.zl shows the bytecode the VM runs.

Editors (and agents with LSP support) can use zl lsp: diagnostics, hover types, go-to-definition and symbols.

Agents can also call the toolchain as an MCP server:

claude mcp add zl -- /path/to/zscript/bin/zl mcp

Its tools are zl_check, zl_sig, zl_run, zl_test, zl_type, zl_fmt, zl_diff, zl_explain and zl_idioms. Each accepts a file path or inline source.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages