Skip to content

Latest commit

 

History

History
136 lines (94 loc) · 3.9 KB

File metadata and controls

136 lines (94 loc) · 3.9 KB

The With Programming Language

A systems programming language that compiles to native code via LLVM. Fast, safe, and designed to feel less hostile than existing native languages.

Specification | Contributing | Editor Support | Devlog

Why With?

  • Performance: Compiles to native machine code via LLVM. No runtime interpreter, no GC pauses. Suitable for games, AI infrastructure, embedded systems, and web services.

  • Safety: Ownership-based memory model with no use-after-free, no double-free, and no data races — without lifetime annotations. Ownership is persistent, borrowing is ephemeral, long-lived relationships use handles.

  • Ergonomics: Indentation-based scoping, type inference, f-string interpolation, first-class regex, let ... else for early returns, with blocks for scoped mutation, and seamless C interop via c_import. The common case should not require ceremony.

What It Looks Like

print("Hello, World!")
var nr = 0
for line in file.read_lines("server.log"):
    nr += 1
    if line =~ /error (\d+)/:
        print(f"{nr}: {line}")
fn handle(req: Request) -> Response:
    let user = db.find_user(req.params.id) else:
        return Response.not_found()
    Response.json(user)
let config = with Config.default() as mut c:
    c.timeout = 30
    c.retries = 3

Quick Start

Install the latest release on macOS arm64 or Linux x86_64:

curl -fsSL https://github.com/withlang-dev/with/releases/latest/download/install.sh | sh

Install the latest release on Windows x86_64 from PowerShell:

irm https://github.com/withlang-dev/with/releases/latest/download/install.ps1 | iex

Or from cmd.exe:

curl.exe -L -o install.cmd https://github.com/withlang-dev/with/releases/latest/download/install.cmd
install.cmd

Inspect the installers before running them:

curl -fsSL https://github.com/withlang-dev/with/releases/latest/download/install.sh | less
irm https://github.com/withlang-dev/with/releases/latest/download/install.ps1

The Unix installer writes with to ~/.local/bin by default. The Windows installer writes with.exe to %USERPROFILE%\.local\bin by default. Set WITH_INSTALL_DIR to choose another directory.

Make sure the install directory is on your PATH, then run:

with run examples/hello.w

All release binaries are listed on the releases page.

Building from Source

Requirements:

  • LLVM toolchain (default /usr/local/llvm, override with LLVM_PREFIX)
  • clang on PATH

The compiler is self-hosting. The build chain is seed -> stage1 -> stage2:

git clone https://github.com/withlang-dev/with.git
cd with
with build :seed        # download seed compiler (if `with` is not on PATH)
with build              # build the compiler
with build :test        # run test suite

Install to your PATH:

with build :install-user    # installs to ~/.local/bin/with

Release publishing uses the checklist in docs/with-release-runbook.md.

Fixpoint Verification

The compiler compiles itself. with build :fixpoint builds stage3 from stage2 and verifies they are byte-identical. If fixpoint breaks, the compiler has a nondeterminism bug.

with build :fixpoint

Editor Support

The compiler includes a built-in language server (with lsp) with diagnostics, go-to-definition, hover, and format-on-save. Setup instructions for VSCode, Neovim, Vim, Emacs, Zed, and Helix are in docs/feature_plans/editor-support.md.

Contributing

See CONTRIBUTING.md for build setup, architecture overview, testing, and debugging instructions.

License

With is distributed under the MIT License.