Teyru

A Java-shaped language that compiles to a native binary. No JVM, no bytecode.

Read the documentation
hello.teyru
class Hello {
  public static void main(String[] args) {
    System.out.println("Hello, Teyru!")
  }
}

Install the compiler

go install github.com/teyru-lang/Teyru/cmd/teyru@latest

Requires Go and clang or gcc.

What it is

Native binary
Compiled through a Go front end, generated C and clang/LLVM into a native executable — no JVM, no bytecode.
Back ends and platforms
The C back end is the default; the LLVM back end (--backend=llvm) emits the program's own module and names what it cannot lower instead of falling back. Windows x86-64 builds and runs today — 179 of 195 test programs byte-identical under Wine — while macOS and Linux arm64 are verified by CI rather than here.
Standard library
Written in Teyru itself — collections, Gson-shaped JSON, regular expressions, streams, time and text — and compiled and checked together with every program.
Digests and bytes
MessageDigest (MD5, SHA-1, SHA-224/256/384/512), CRC32 and HexFormat are implemented in Teyru, and the buffered and binary streams speak Java's modified UTF-8. There is a Scanner too.
Compression
Deflate and gzip are written in Teyru. Level 0 output is byte-identical to zlib's, and the two inter-operate both ways: it decodes the JDK's output at levels 0, 1, 6 and 9, and the JDK decodes its. The honest half: at level 6 it is about 1.5% larger and about 2.8x slower than zlib (measured) — anyone who checks will find that anyway.
Annotations
Lombok-compatible, expanded into ordinary members during semantic analysis.
Web framework
A Spring-shaped container and web layer over an HTTP/1.1 server: SpringApplication.run reads application.properties, @ConfigurationProperties binds it, @Profile picks beans, and advice, interceptors, static files and CORS are all there — with the routes compiled.
Sessions
Sessions.of(req) finds the session a request's cookie names, and the server stamps that cookie on the answer on the way out, so a run of requests has one identity.
Validation
@NotNull, @Size, @Min and @Max on a field, checked by Validation.check; a bound body that breaks one is a 400 that says which field.
Uploads
HttpRequest.multipart(name) hands back the part a multipart form sent, as a MultipartFile: field name, original filename, content type, bytes.
HTTP client
Http.get and HttpClient send real requests and reuse a keep-alive connection, and the accept loop (ServerTask) runs on a thread — a client and a server in one program.
WebSocket
Implement WebSocketHandler and mark it @WebSocketMapping to have it declared like a controller; WebSocketSession is the connection after the upgrade.
Threads
Real operating system threads, real synchronized (the method modifier too) and Object.wait/notify, plus executors, latches, atomics and a concurrent map — those last ones are monitors, not lock-free.
JSON binding
Gson-shaped, with the object binding generated by the compiler.
Garbage collector
A C runtime with a conservative mark-and-sweep collector and no virtual machine.