Built on 4 Design Principles

Build software that must be safe before it compiles.

ClearLang is intentionally simple for users, AI-friendly, provably correct, and crypto-focused, so high-assurance code is practical instead of niche.

Simple

Familiar syntax

AI-Friendly

Predictable tooling

Provably Correct

Compile-time proofs

Crypto-Focused

Deterministic safety

ClearLang proof-first compiler visualization

The 4 Design Principles

These principles define ClearLang's direction: approachable syntax, predictable AI workflows, proof-backed correctness, and contract-grade crypto guarantees.

Simple for Users

Python/Java-like structure and reduced boilerplate let teams move fast without deep theorem-prover expertise.

AI-Friendly

Consistent syntax and stable diagnostics help AI generate and repair code with less ambiguity.

Provably Correct

Refinement types plus `require`/`ensure` contracts enforce invariants before unsafe code can compile.

Crypto-Focused

Deterministic runtime behavior, effect discipline, and resource ownership target smart-contract failure modes.

type Nat = Int where n >= 0

resource Token {
  balance: Nat;
  drop { }
}

mut function transfer(from: Token, to: Token, amount: Nat) -> Nat
  require { amount <= token::balance(from) }
  ensure  { result == old(token::balance(from) + token::balance(to)) }
{
  token::set_balance(from, token::balance(from) - amount);
  token::set_balance(to, token::balance(to) + amount);
  token::balance(from) + token::balance(to)
}

Why this matters

  • Reentrancy risks: effect sequencing makes unsafe patterns difficult to express.
  • Invariant bugs: type and contract checks enforce balance/supply rules.
  • Audit overhead: proof metadata and signed artifacts shift trust left.
  • AI reliability: predictable grammar + diagnostics enable safer code generation loops.

AI Instruction -> Verified Output

ClearLang is structured for instruction-to-code workflows where generated output still has to satisfy explicit correctness constraints.

AI prompt to verified ClearLang to Wasm pipeline

Current Project Snapshot

Roadmap phases are largely complete with strong emphasis on diagnostics, strict policy gates, signing, and deterministic package/runtime behavior.

Compiler + typer + IR + Wasm pipeline

`clg build` / `clg run` / `clg verify`

Signed proof and assurance manifests

Build, Sign, Verify

ClearLang supports packaging proof metadata into Wasm modules, signing canonical payloads, and verifying them offline.

clg build examples/contract.clear -o out.wasm --emit-vcs out.vc.json \
  --sign --key keys/signing.json --key-id demo --scope both --sig-out out.sig.json

clg verify --module out.wasm --sig out.sig.json --pubkey keys/public.json --explain
Wasm portability targets across web, mobile, backend and blockchain