Write expressive code. Ship native binaries and WebAssembly.
A statically typed, ahead-of-time compiled language with automatic memory management, specialized generics, and a standard library built for real applications.
Optimized ARC · GPU shaders in Dream · Typed web APIs · Seamless C, C++, and JavaScript interop · Native + WebAssembly
On macOS or Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sps014.github.io/dream/install.sh | shOn Windows, open PowerShell:
irm https://sps014.github.io/dream/install.ps1 | iexOpen a new terminal, then create and run a project:
dreamer init console hello
cd hello
dreamer runYour program lives in src/main.dream; project settings live in dream.toml. The generated starter prints Hello, world!. Replace it with the JSON example below to try a little more of the language.
Continue with the quickstart, language tour, or first complete project.
import system;
import system.json;
@json
class Developer {
name: string;
languages: string[];
public constructor(name: string, languages: string[]) {
this.name = name;
this.languages = languages;
}
}
fun main() {
let dev = Developer("Ada", ["Dream", "TypeScript"]);
System.println(Json.serialize(dev));
}{"name":"Ada","languages":["Dream","TypeScript"]}Typed data, automatic cleanup, and JSON serialization generated at build time. Paste it into src/main.dream and run dreamer run.
Dream is pre-1.0 and actively evolving. Expect breaking changes as the language develops.
Dream is for application code that compiles ahead of time and runs where you choose. If you know TypeScript, Rust, or C#, much of the syntax will feel familiar.
Build a native executable, or compile to WebAssembly for the browser and Node. Share core logic across targets, then use each environment's APIs where you need them. See environments.
Import system.gpu and write compute, vertex, and fragment shaders as Dream functions. Typed buffers and generated shader calls connect your application to the GPU. Shaders compile ahead of time, so no shader source or shader compiler ships with your program.
- Start with WebGPU for native and browser programs, or choose Metal, Vulkan, Direct3D, or CUDA.
- Rendering, ray tracing, and tensor operations depend on the backend and the GPU.
- CUDA is compute-only. Ray tracing needs a native backend.
Install the shader compiler before building a program with shaders:
dreamer toolchain install slangStart with GPU setup, then rendering, the spotlight, ray tracing, or machine learning. A GPU failure is a Result with a GpuError.
Objects are freed when nothing uses them. There is no garbage collector.
- Classes, strings, and arrays are shared. Structs are copied.
- Passing a value for the last time hands it over. There is no
movekeyword. - Write
borrowwhen a function should only look at a value. - An out-of-bounds index stops the program with an error.
- A reference cycle is a compile error. Use
@allow_cycleonly when your code breaks the cycle.
Read ownership, memory, and cycles.
Declare a foreign function and call it like any Dream function. Dream converts values at the boundary.
| Interop | Runs on | What you get |
|---|---|---|
| C | Native, browser, Node | @c functions, C sources in a package, and callbacks from C. |
| C++ | Same as C | @cpp maps classes, methods, constructors, and templates. std::optional, exceptions, and std::function map to Option, Result, and Dream closures. |
| JavaScript | Browser, Node | extern fun for known signatures, the dynamic js type for DOM nodes and other live values, callbacks in both directions, and extern async fun for Promises. An optional tree-shaken runtime ships only the host code your program uses. |
system.webapi builds native HTTP services. A route is a typed static method, so a handler cannot receive an argument of the wrong type.
import system;
import system.json;
import system.webapi;
@json
class Greeting {
public message: string;
public constructor(message: string) {
this.message = message;
}
}
@router("")
class Routes {
@get("/hello/{name}")
public static fun hello(@path name: string): Greeting {
return Greeting("Hello, " + name);
}
}
async fun main(): void {
let app = WebApp();
app.include_router(Routes.router()).unwrap();
app.run("127.0.0.1", 8000).await.unwrap();
}Run it with dream run app.dream and open http://127.0.0.1:8000/hello/Dream. Interactive Swagger documentation is served at /docs.
The framework also includes validated request models, dependency injection, middleware and CORS, password and token authentication, OAuth2/OIDC login, scopes, uploads, server-sent events, WebSockets, and TLS. Servers run on native targets. Start with the web server guide.
Generics are specialized for the concrete types you use.
- Use classes and interfaces for shared objects, structs for copied values, and enums for alternatives.
OptionandResultput missing values and recoverable failures in the type.
Use async/await for work that waits, and tasks for CPU work. A task scope joins its children when it finishes, fails, or is cancelled.
Start with structured concurrency, then use tasks and pools when you need parallel execution.
Source generators are ordinary Dream functions. They can add methods and turn a custom block into checked Dream code during a build.
@json in the first example is one of these. See source generators.
The standard library covers collections, files, JSON, HTTP, regex, dates, crypto, processes, logging, and testing. Dream also includes a web API framework with typed routes, validation, and generated OpenAPI documentation.
- CLI tools and automation: work with files, processes, and command-line arguments.
- HTTP services: build your first web API, then add validation, authentication, and streaming.
- Browser and Node modules: compile to WebAssembly and connect to JavaScript APIs.
- GPU applications: run compute shaders, build renderers, or explore GPU machine learning.
- Reusable libraries: combine collections, generics, and source generators, then publish a package.
Each feature guide explains which environments it supports.
Dreamer handles projects, dependencies, builds, tests, and packaging:
dreamer run # Build and run your app
dreamer build --release # Build an optimized version
dreamer test # Run your project's tests
dreamer add <package> # Add a dependency
dreamer pack # Package a CLI app for sharing
dreamer toolchain doctor # Check required build toolsDream includes editor completion, diagnostics, formatting, and navigation. Follow editor setup, browse the Dreamer guide, or use troubleshooting if you get stuck.
Found a bug or have a language idea? Open a GitHub issue. For bugs, include a small program, the command you ran, and the error text.
To work on the compiler, runtime, or tools, start with the contributor handbook. For documentation changes, read the maintenance guide.