Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/elfrask/cls/llms.txt

Use this file to discover all available pages before exploring further.

CLS is a modular, WASM-first programming language designed for safe, cross-platform development. Written entirely in Rust, it compiles source files (.clsx) through a full frontend pipeline — lexer, parser, AST, type checker, and optimizer — before handing off to a tree-walking interpreter today and a WASM codegen backend in the future. CLS ships with JSX-like native markup syntax (CMX), a virtual filesystem with sandbox controls, a complete standard library, and a first-class LSP server — making it equally at home in embedded runtimes and fully-featured desktop toolchains.

Key Features

Static Type Checker

CLS performs full static analysis before execution. Annotate your variables, function parameters, and return types with primitives like int, float, String, bool, and composites like Array<T> and Record<K, V>. Run clx check at any time to catch errors before runtime.

Async / Await

First-class asynchronous programming is built into the language. Declare async function blocks and await any async expression inline — no callback pyramids or manual promise chaining required.

CMX Markup

CLS includes native JSX-style markup syntax called CMX. Lowercase tags produce CmxValue objects with tag and props fields; uppercase tags perform reference lookups and call the corresponding function directly. Children and dynamic expressions are fully supported.

Virtual Filesystem (VFS)

All file I/O goes through a protocol-based virtual filesystem. URI schemes like app://, user://, tmp://, and res:// abstract the underlying OS paths and enforce sandbox policies configured in cls.json.

LSP Server

clx lsp starts a full Language Server Protocol server over stdin/stdout or TCP. It delivers real-time diagnostics, keyword and symbol completions, hover documentation, and go-to-definition — integrating with any LSP-capable editor.

Embeddable Runtime

cls-runtime is a standalone Rust crate with no hard I/O dependencies. Any host application can embed the CLS interpreter by providing its own module resolver, intrinsic functions, and stdlib bindings — making CLS scriptable inside larger systems.

Architecture Overview

CLS is split into three cleanly separated layers. Each layer has a single responsibility and depends only on the layer below it, which is what keeps the runtime embeddable and the core portable:
┌─────────────┐    ┌──────────────┐    ┌───────────────┐
│   cls-core   │    │  cls-runtime  │    │  clx / clxr   │
│  (compiler)  │───▶│  (executor)   │───▶│   (nodes)     │
│ lexer, parser│    │ interpreter   │    │ CLI, modules, │
│ type checker │    │ stdlib, VFS   │    │ LSP server    │
│ optimizer    │    │ intrinsics    │    │ package mgmt  │
└─────────────┘    └──────────────┘    └───────────────┘
cls-core is the pure language layer. It contains the lexer, parser, AST definitions, type checker, name resolver, and optimizer. It has no filesystem access and no runtime dependencies — just language logic. cls-runtime is the execution layer. It houses the tree-walking interpreter, the runtime value system, the scoped environment, the virtual filesystem, the standard library core (math, json, async), and the security sandbox. It accepts resolvers and intrinsics from the host rather than hard-coding them. clx / clxr are the nodes — the executables that wire everything together for a specific environment. clx is the full desktop development CLI with filesystem, network, LSP server, and package management. clxr is a lightweight runtime-only executor for running packaged .clsapp files in production. Nodes supply the resolvers, OS modules (fs, http), and configuration that cls-runtime depends on at execution time. The source-to-execution pipeline for a development workflow looks like:
.clsx → Lexer → Parser → AST → Type Checker → Optimizer → Tree-walker
                                                         → JSON backend (AST dump)
                                                         → WASM codegen (future → .clbin)

File Extensions

ExtensionDescription
.clsxCLS source code — the file type you write and edit day-to-day
.clsappPackaged application — a zip bundle of source and modules produced by clx build
.clslibCompiled library — zip format, planned for the WASM backend
.clbinCompiled WASM binary — future output of the WASM codegen backend
cls.jsonProject manifest — name, version, entry point, compiler settings, sandbox policy, and dependencies
.clsiType interface file — describes exported declarations for type maps and editor autocompletion

What’s Next

Installation

Build clx and clxr from source with Cargo. Get the full toolchain running on your machine in under five minutes.

Quickstart

Create a project, write Hello World, run the type checker, and build a packaged app — step by step.

Language Syntax

Variables, functions, control flow, CMX markup, async/await, error handling, and every other language construct in detail.

clx CLI Reference

Every clx subcommand — run, check, build, maptype, lsp, repl, and more — with flags and examples.

Build docs developers (and LLMs) love