| Types |
int, int8–int64, uint–uint64, float, double, bool, char, string, void, *T pointers, T[N] fixed arrays, union |
| Literals |
Decimal, hex 0xFF, float, string (with adjacent concat), char, bool, null |
| Operators |
Arithmetic + - * / %, bitwise & \| ^ ~ << >>, comparison, logical, compound += -= etc., typed pointer arith ptr+n (advances by sizeof(*ptr)), sizeof(T) |
| Control flow |
if/else, for (with decl init), while, switch/case, break, continue, return |
| Functions |
C-style, extern C ABI (functions and global variables), variadic, template fn<T>(T x) |
| Lambdas / Closures |
int(int x) { return x * 2; }: anonymous functions; fn(T,...)->R fat-pointer types; closure capture by value; higher-order functions |
| Threads |
thread_create(fn()->void) / thread_join(*void): OS thread keywords; closure fat pointer maps directly to pthread ABI |
| Exceptions |
try/catch/finally/throw: LLVM invoke/landingpad, Itanium ABI; multiple catch clauses; link -lc++ (macOS) or -lstdc++ (Linux) |
| Async / await |
async function lowered to a resumable state-machine coroutine; a call yields *Future<T>; await suspends until ready. Runtime in <future>/<executor>/<eventloop> |
| Enums / match |
enum of named integer constants; payload-bearing variants form algebraic data types (tagged unions), destructured with exhaustive match; generic enums (Option<T>, Either<A,B>) |
| Structs |
Fields, methods with self, struct literal init Point { x: 1, y: 2 }, bitfields f: N, packed layout |
| Templates |
struct Result<T,E>, fn Ok<T,E>(T v): monomorphic instantiation; bounded generics <T: Iface> / <T: A + B> (a primitive satisfies a constraint via a free function) |
| Collections |
<list> List<T>, <map> Map<V> (string-keyed) / HashMap<K,V>, <string> String, <bytes> binary-safe Bytes buffer |
| Interfaces |
interface Drawable { void draw(); }: structural typing, vtable dispatch |
| Memory |
Stack default; heap via <mem> alloc<T>(n) / free; explicit allocators <alloc> via alloc_with; typed pointer arithmetic |
| volatile |
volatile let reg: *uint8 = (uint8*) 0x3F8;: MMIO-safe loads/stores |
| Inline asm |
asm("cli"); simple form; asm("outb ${0:b}, $1" :: "a"(v), "Nd"(p) : "memory"); extended form (LLVM operands are $0/$1) |
| Freestanding |
--freestanding flag: <mem> alloc<T>/free call esk_alloc/esk_free; user-supplied in kernel |
| Cross-compile |
--target TRIPLE (AArch64, x86-64, 32-bit ARM), plus --mcpu / --mattr / --reloc; hard-float ARM for the 3DS, COFF for Windows. See cross-compile.md |
| Multi-file |
import <result> stdlib modules · import "file.esk" relative local files |
| Errors |
file.esk:8:22: message: real line/col from parser |
| HTTP/2 |
<http2> frame codec + connection/stream state machine, <hpack> header compression, <tls> (h2 over OpenSSL with ALPN), <http2_server> (h2c): full multiplexed HTTP/2 stack |
| Stdlib |
Core (<result>, <list>, <string>, <math>, <io>, <mem>, <fs>, <path>, <base64>, <json>, <time>, <env>); memory (<alloc>, <sysheap>); concurrency (<threading>, <atomic>); the async runtime (<eventloop>, <future>, <executor>, <net_async>, <timer>, <channel>, <futureval>); sum types (<either>); networking (<net>, <http>, <http_async>); and the HTTP/2 stack (<http2>, <hpack>, <tls>, <http2_server>) |