Teyru
A Java-shaped language that compiles to a native binary. No JVM, no bytecode.
Read the documentationclass 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.
- 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.
- 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.