From source to program
Write Tessera
Source files are plain UTF-8 text with the
.tesextension. Imported modules are found relative to the entry file.Check
The compiler parses the program, resolves names, checks types and checks effects. Errors come with a stable code and a suggested fix.
Generate Rust
The checked program is translated to safe Rust, together with a small runtime.
Build
rustcturns the Rust into a native executable, or into a shared library for a web server. For now you need a Rust toolchain.Run
As a command-line program, or, for web applications, as CGI, FastCGI, a built-in HTTP server, or inside nginx or Apache through a native module.
A compiler written in Tessera
The first compiler, stage 0, is written in Rust. It compiled the second one, stage 1, which is written in Tessera itself and is the compiler used today. So that anyone can start the chain with nothing but rustc, the repository contains a generated Rust seed of the stage 1 compiler.
The plan is to continue until the compiler compiles its own source and produces the same compiler again, running the same tests against every stage. That is what self-hosting means, and it is a demanding test for a language that claims to be practical.
Safe Rust underneath
Generated programs carry #![forbid(unsafe_code)]. The only unsafe code in the runtime is a small adapter that lets a web server load a Tessera program as a shared library.
One function, four ways to host it
A Tessera web application is a program with one function, handle(request) -> response. The same source can run as:
- CGI: one process per request, the simplest setup.
- FastCGI: a long-running process behind nginx or Apache.
- HTTP server:
app serve, behind any reverse proxy, ideal for containers. - Native module: the program is loaded into the nginx or Apache worker processes, for the lowest overhead.
This website uses the native nginx module. See This website for what that looks like in practice.
Read the hosting guide
The hosting guide describes every way to run a Tessera web application, with configuration for each server.