Features

A quick tour through WCL's major features. The language reference covers each in detail.

Typed configuration

Fields bind names to values; blocks group fields under a kind and a label. Numeric literals carry exact-width suffixes (u32, i64, f64), and strings come in four encodings (utf8/ascii/utf16/utf32).

name    = "alpha"
count   = 3u32
enabled = true

service "web" {
  port = 8080u32
  metadata {
    region = "us-east-1"
  }
}

Schema validation

A schema declared with decorators describes what's legal at each level. wcl check validates a document against its @document root, reporting violations with spans.

@block("service")
type Service {
  @inline(0)   name: utf8
  @default(80) port: u32
}

@document
type Config {
  @children("service") services: list<Service>
}

Types, interfaces, and unions

Records (type), structural contracts (interface), and tagged sums (union) — with record / typeref / unit variants. Use extends to inherit fields or variants, and &T for an interface-typed reference field.

union Shape {
  Circle { radius: f64, stroke: f64 }
  Polygon i32
  Empty
}

interface Drawable { x: f64  y: f64 }
type Scene { focus: &Drawable }

First-class functions

Functions are values: fn(params) -> Return body. They can take and return other functions, and they participate in lazy field evaluation with cycle detection.

double = fn(x: i32) -> i32 x * 2
adder  = fn(x: i32) -> fn(i32) -> i32 fn(y: i32) -> i32 x + y

Pattern matching

match tests against literals, bindings, variant patterns, | alternatives, if guards, the _ wildcard, and the .. rest.

area = match shape {
  Shape::Circle { radius, .. } => pi() * radius * radius,
  Shape::Polygon(n) if n > 2   => 0.0,
  _                            => 0.0,
}

CLI tooling

The wcl binary parses, checks, evaluates, edits, and reformats source. wcl eval resolves a dotted path; wcl set rewrites a field in place (following imports); wcl fmt reformats canonically; wcl repl is an interactive evaluator.

wcl check site.wcl
wcl eval  site.wcl service.web.port
wcl get   site.wcl name --json
wcl set   site.wcl service.web.port 9090u32
wcl fmt   site.wcl --in-place
wcl repl  site.wcl

Each subcommand is covered in the CLI reference.

Language server

wcl lsp is a tower-lsp-based language server with diagnostics, formatting, document symbols, go-to-definition (cross-file), find-references, hover, completion, semantic tokens (including inside ${…} interpolation slots), and quick-fix code actions. It speaks stdio by default and TCP with --tcp ADDR.

Editor stubs

editors/vscode ships a minimal VS Code extension that spawns wcl lsp for .wcl files, and editors/tree-sitter-wcl is a tree-sitter grammar for editors that consume them.

Documentation with wdoc

wcl wdoc renders WCL page blocks to a static documentation site — diagrams, charts, syntax-highlighted code, LaTeX math, character-grid terminals, calendar timelines, icon packs, and built-in colour themes. This very site is built with it.

site mysite {
  default_template = :webpage
  title            = "My project"
  root             = true
  theme            = :nord
}

page index { sites = [:mysite]  start = true
  h1 "My project"
  p "Authored in WCL, rendered to HTML by **wcl wdoc**."
}

Try it

wcl wdoc serve docs/main.wcl rebuilds on every .wcl save — see Getting started for the full walkthrough.

Ready to write some WCL? Head to getting started, or jump into the language reference.