Skip to main content

What Is Morph?

Morph is a high-performance, compiled programming language designed for artificial intelligence, scientific computing, and GPU-accelerated workloads.


Design Goals

Morph is built around four core principles:

PrincipleDescription
C++ PerformanceCompiles to native machine code — no interpreter overhead
ReadabilityNatural-language keywords instead of cryptic symbols
Simple Memory ModelAlias-by-default with explicit copy and move controls
GPU & Tensor NativeFirst-class tensor types and gpu { } execution blocks

The Morph Framework (this is the main event)

The language syntax you learn in these tutorials (control flow, types, tensors, GPU blocks, modules, tests, …) is almost entirely owned by Morph packages under morphs/, not baked in as permanent src/parser specials. Each package exports semantic extensions, NIR lowers/optimizers, backend routes (host.llvm, Vulkan, SPIR‑V, NN graph, REPL, …), runtime families, and even nested CLI tooling—wired through the package root morph.toml, nested feature.toml and block.toml (grammar [forms.*]), and the stable ABI in MorphABI.h.

So Morph is two things at once: a compiler host and a composable plugin graph. If you only read syntax chapters, you miss why features are portable and where to add new ones.

Start here: Morph framework overview · Plugin-governed pipeline.


How It Works

Morph separates how sources are compiled from how they are shipped or sandboxed.

1. LLVM native path (typical morph build / morph run)

For normal projects, morph build and morph run drive the LLVM-oriented pipeline end-to-end: frontend → NIR → LLVM → native executable. See Build pipeline.

Source (.mx) → Lexer → Parser → Semantic analysis → NIR → LLVM → native binary

2. Web target (morph build --target=web / morph run --target=web)

Web builds emit artifacts under build/web and use the browser/WASM stack configured in [web] inside morph.toml.

3. VCON containers (morph vcon …)

Portable bytecode + VM flows are handled under morph vcon, not by plain morph run. Use VCON when you need the sandboxed container model, nucleus embedding, or morph vcon watch-style hot reload.

Source (.mx) → … → NIR → bytecode / container tooling → .vcon → VM or nucleus host

Key Features

  • is keyword for variable binding (optional for methods and classes)
  • another for deep copies, move for ownership transfer
  • address of / value of — readable pointer syntax
  • One class per file — enforced by the compiler
  • gpu { } blocks with automatic CPU fallback
  • First-class tensors with @ matrix multiplication
  • Generics with type constraints
  • async / await concurrency
  • try / catch / finally error handling
  • VCON for portable, sandbox-oriented containers (morph vcon …)
  • Hot reload via morph vcon watch (VCON workflow), not via ordinary morph run

A Quick Look

module System;

Init is method() {
x is 42;
y is another x;
name is "Morph" as string;

Print(name);
Print(x + y);
}

This program (e.g. in Main.mx):

  1. Declares a dependency on the System module (built-in I/O helpers such as Print; see Standard library).
  2. Declares x as an alias-bound integer.
  3. Creates y as an independent copy of x.
  4. Prints "Morph" and 84.

Next Steps