Table of Contents

Appendix D: Glossary

Terms are listed alphabetically. Page references point to the chapter where the concept is first introduced.


ADT (Algebraic Data Type) — An enum whose variants can carry data. enum Shape { Circle(int), Rect(int, int) } is an ADT. Each variant is a different "shape" of data. (Chapter 14)

Array — An ordered, dynamically-sized collection of values. Created with [1, 2, 3] or Array.new(). Arrays in Nyx can hold values of mixed types. (Chapter 6)

AST (Abstract Syntax Tree) — A tree representation of your source code, produced by the parser. Each node represents a construct (function, variable, expression). The compiler uses this tree to generate code. (Chapter 20)

Async — A programming model where operations can be started without waiting for them to complete. In Nyx, async/await is syntactic sugar — real parallelism comes from spawn and thread_spawn. (Chapter 23)

ACK (Acknowledgment) — A message sent by a consumer to confirm that a message has been successfully processed. In nyx-queue, ACK queue msg_id removes the message from the delivery list. (Chapter 29)

Atomic operation — A CPU instruction that completes in one step, with no possibility of interruption by another thread. atomic_load and atomic_store are atomic. Used for lock-free programming. (Chapter 24)

Binary — The executable file produced by the compiler. A binary contains machine code that the CPU can execute directly, with no interpreter needed. (Chapter 1)

Bootstrap — The process of compiling a compiler with itself. Nyx's compiler is written in Nyx. The seed files (compiler/.ll) are used to build the first compiler, which then compiles itself. (Chapter 20)*

Boehm GC — The garbage collector used by Nyx. It is a conservative, mark-and-sweep collector that automatically frees memory that is no longer reachable. Named after Hans-Juergen Boehm. (Chapter 20)

Borrow — Taking a reference to a value without taking ownership. In Nyx, &x creates a reference. Note: Nyx does not have a borrow checker — references are aliases for pointers. (Chapter 22)

Channel — A thread-safe queue for sending values between threads or goroutines. Created with channel_new(capacity). The primary way to communicate between concurrent tasks. (Chapter 18)

Closure — A function that captures variables from its enclosing scope. When you write fn(x: int) -> int { return x + offset } inside another function, and offset comes from the outer function, that is a closure. (Chapter 13)

Compiler — A program that translates source code into another form. The Nyx compiler translates .nx files into LLVM IR, which LLVM then compiles to machine code. (Chapter 1)

Concurrency — Running multiple tasks that make progress during overlapping time periods. Does not require multiple CPUs — even one CPU can switch between tasks. (Chapter 18)

Cross-compilation — Compiling a program on one architecture (e.g., x86) to run on a different architecture (e.g., ARM). make cross TARGET=aarch64-linux-gnu. (Chapter 24)

Deadlock — A state where two or more threads are each waiting for the other to release a resource, so none can make progress. A common concurrency bug. (Chapter 18)

Derive — A macro that automatically generates trait implementations. #[derive(Clone, Debug, Display)] generates clone(), debug(), and to_string() methods. (Chapter 15)

Dynamic dispatch — Calling a trait method through a dyn Trait reference, where the actual function to call is determined at runtime via a vtable. Slower than static dispatch but more flexible. (Chapter 15)

Enum — A type that can be one of several variants. Simple enums: enum Color { Red, Green, Blue }. Enums with data: enum Option { Some(T), None }. (Chapter 14)

epoll — A Linux system call for monitoring multiple file descriptors. Nyx uses epoll internally for its event loop, enabling efficient I/O multiplexing. (Chapter 23)

Event loop — A programming pattern that waits for events (network data, timers) and dispatches them to handlers. Nyx's event loop is epoll-based and powers async I/O. (Chapter 23)

Expression — Code that produces a value: 2 + 3, f(x), if a > b { a } else { b }. Contrast with statement. (Chapter 2)

FFI (Foreign Function Interface) — A mechanism for calling functions written in another language. extern "C" fn puts(s: String) -> int declares a C function callable from Nyx. (Chapter 21)

Fixed point — When compiling the compiler twice produces identical output. This proves the compiler is self-consistent. (Chapter 20)

Float — A 64-bit floating-point number (IEEE 754 double precision). Written as 3.14, -0.5. (Chapter 3)

Frame — The basic unit of communication in HTTP/2. Each frame has a 9-byte header (length, type, flags, stream ID) followed by a payload. Frame types include DATA, HEADERS, SETTINGS, PING, and GOAWAY. (Chapter 30)

Function — A named, reusable block of code. fn add(a: int, b: int) -> int { return a + b }. (Chapter 5)

Garbage collector (GC) — A system that automatically frees memory that is no longer in use. Nyx uses the Boehm GC by default. No-GC mode is available for systems programming. (Chapter 20)

Generic — A function or type parameterized by one or more type variables. fn first(arr: Array) -> T works with any type. Nyx implements generics via monomorphization. (Chapter 16)

Goroutine — A lightweight concurrent task created with spawn { }. Many goroutines map onto fewer OS threads via the M:N scheduler. Inspired by Go. (Chapter 23)

HPACK — The header compression algorithm used by HTTP/2. Uses a static table of 61 common header name-value pairs and Huffman encoding to reduce header overhead. For example, :status: 200 is encoded as a single byte 0x88. (Chapter 30)

Heap — A region of memory for dynamically allocated data. Objects on the heap live until freed (manually or by GC). Contrast with stack. (Chapter 20)

Immutable — Cannot be changed after creation. Variables declared with let are immutable. (Chapter 2)

Impl block — A block that defines methods on a type. impl Point { fn new() -> Point { ... } }. Also used to implement traits: impl Display for Point { ... }. (Chapter 9)

Import — Bringing definitions from another module into the current scope. import "std/json" or import { parse } from "std/json". (Chapter 11)

Inline assembly — Writing CPU instructions directly in Nyx code: unsafe { asm("nop") }. Uses AT&T syntax. (Chapter 24)

Int — A 64-bit signed integer. The default numeric type in Nyx. Written as 42, -7, 0xFF. (Chapter 2)

IR (Intermediate Representation) — Code in a format between source and machine code. Nyx generates LLVM IR, which LLVM then optimizes and compiles to native code. (Chapter 20)

Iterator — An object that produces a sequence of values one at a time. Created with .iter(). Supports chaining: arr.iter().filter(f).map(g).collect(). (Chapter 7)

Lambda — An anonymous function. In Nyx: fn(x: int) -> int { return x 2 }. Also called a closure when it captures variables. (Chapter 13)*

LLVM — Low Level Virtual Machine. A compiler infrastructure that Nyx uses as its backend. LLVM takes IR and produces optimized machine code for many architectures. (Chapter 20)

Lock-free — A concurrency approach that uses atomic operations instead of mutexes. No thread can block another. (Chapter 24)

M:N scheduler — A scheduler that maps N user-level tasks (goroutines) onto M OS threads. Uses work-stealing for load balancing. (Chapter 23)

Message queue — A buffer that holds messages until a consumer is ready to process them. Unlike Pub/Sub, each message goes to exactly one consumer (round-robin) and messages persist until acknowledged. nyx-queue implements this pattern. (Chapter 29)

Middleware — A function that runs before route handlers in a web framework, processing or transforming requests. In nyx-serve, middleware is registered with app_use() and can short-circuit the chain by returning a non-zero status. (Chapter 27)

Map — A hash table mapping keys to values. Created with Map.new(). Nyx Maps use Robin Hood hashing with open addressing. (Chapter 8)

Match — Pattern matching on values. match x { 0 => ..., 1 | 2 => ..., _ => ... }. Exhaustive checking ensures all cases are covered. (Chapter 14)

Method — A function defined inside an impl block that takes self as its first parameter. Called with dot syntax: point.distance(). (Chapter 9)

Multiplexing — Sending multiple independent streams of data over a single connection. HTTP/2 multiplexes requests using stream IDs, allowing many concurrent request/response pairs without opening multiple TCP connections. (Chapter 30)

Module — A file containing Nyx code that can be imported by other files. Symbols are made available with export. (Chapter 11)

Monomorphization — The process of generating specialized versions of generic code for each concrete type used. fn first called with int generates fn first_int. (Chapter 16)

Mutable — Can be changed after creation. Variables declared with var are mutable. (Chapter 2)

Namespace — An isolated scope for keys or resources, preventing naming collisions between different users or services. In nyx-kv, AUTH creates per-user namespaces by transparently prepending user_id:: to all keys. (Chapter 25)

Mutex (Mutual Exclusion) — A lock that ensures only one thread can access a resource at a time. mutex_new(), mutex_lock(m), mutex_unlock(m). (Chapter 18)

NACK (Negative Acknowledgment) — A message sent by a consumer to indicate that processing failed and the message should be returned to the queue for redelivery. In nyx-queue, NACK queue msg_id. (Chapter 29)

Naked function — A function with #[naked] attribute that has no compiler-generated prologue or epilogue. Used for interrupt handlers and low-level code. (Chapter 24)

Newtype — A struct with a single field, used to create a distinct type. struct Meters(int). Provides type safety without runtime overhead. (Chapter 9)

Null — The absence of a value. In Nyx, prefer Option (Some(value) or None) over null to make absence explicit. (Chapter 14)

Parallelism — Executing multiple tasks simultaneously on multiple CPUs. Requires multiple threads or processes. Distinct from concurrency. (Chapter 18)

Pattern matching — Destructuring values by their shape. match opt { Some(x) => use(x), None => default() }. Supports literals, enums, structs, guards, and wildcards. (Chapter 14)

Pipe operator|> passes the result of the left expression as the first argument to the right function. data |> transform |> print. (Chapter 7)

Pointer — A memory address. In Nyx, int is a pointer to an int. Raw pointers require unsafe blocks. (Chapter 22)*

Pub/Sub (Publish/Subscribe) — A messaging pattern where publishers send messages to named channels and all subscribers receive them. Fire-and-forget — if nobody is listening, the message is lost. nyx-kv implements SUBSCRIBE, PUBLISH, and UNSUBSCRIBE commands. (Chapter 28)

Race condition — A bug where program behavior depends on the timing of thread execution. Happens when threads access shared data without synchronization. (Chapter 18)

RESP (Redis Serialization Protocol) — The text-based protocol used by Redis. nyx-kv implements RESP for compatibility with Redis clients. (Chapter 25)

Robin Hood hashing — The hash table strategy used by Nyx Maps. Entries that are far from their ideal position "steal" from entries that are closer, reducing worst-case lookup time. (Chapter 25)

Runtime — The code that supports a running Nyx program: garbage collector, string operations, networking, threading. Written in C (21 files). (Chapter 20)

Scope — The region of code where a variable is visible. Variables declared inside { } are only visible within those braces. (Chapter 5)

Self-hosting — A compiler that can compile its own source code. Nyx's compiler is written in Nyx. (Chapter 20)

Sized type — A type with a specific bit width: i8, i16, i32, u8, u16, u32, f32. Used for hardware interaction and binary protocols. (Chapter 24)

Stack — A region of memory for local variables and function call frames. Fast to allocate/deallocate. Limited in size (~8KB per thread). Contrast with heap. (Chapter 20)

Statement — Code that performs an action but does not produce a value: let x: int = 5, print("hello"), return 0. Contrast with expression. (Chapter 2)

Static dispatch — Calling a trait method where the concrete type is known at compile time. The compiler inlines the call. Faster than dynamic dispatch. (Chapter 15)

String — A sequence of UTF-8 characters. Created with double quotes: "hello". Immutable in Nyx — concatenation creates new strings. Use StringBuilder for efficient building. (Chapter 3)

Stream — In HTTP/2, a logical request/response pair within a single TCP connection. Streams have numeric IDs — odd for client-initiated, even for server push, 0 for connection-level frames. Multiple streams can be active simultaneously. (Chapter 30)

StringBuilder — An efficient way to build strings incrementally. sb_new(), sb_append(sb, str), sb_to_string(sb). O(n) instead of O(n²) for concatenation. (Chapter 20)

Struct — A composite type with named fields. struct Point { x: int, y: int }. Structs are value types in Nyx. (Chapter 9)

Thread — An OS-level execution unit. Created with thread_spawn(fn). Each thread has its own stack but shares heap memory. (Chapter 18)

Trait — An interface that defines behavior. trait Display { fn to_string(self) -> String }. Types implement traits with impl Trait for Type { ... }. (Chapter 15)

Trait bound — A constraint requiring a type parameter to implement a trait. fn print_it(val: T). (Chapter 16)

Tuple struct — A struct with unnamed fields, accessed by index. struct Color(int, int, int). (Chapter 9)

Type inference — The compiler deducing the type of a variable from its value. let x = 42 infers x: int. (Chapter 2)

Unsafe — Code that bypasses Nyx's safety guarantees. Required for raw pointers, manual memory, volatile access, and inline assembly. unsafe { ... }. (Chapter 22)

Variable shadowing — Declaring a new variable with the same name as an existing one. The new variable hides the old one in its scope. (Chapter 2)

Volatile — A memory access that the compiler cannot optimize away or reorder. Used for hardware register access. volatile_read(ptr), volatile_write(ptr, val). (Chapter 24)

Vtable — A table of function pointers used for dynamic dispatch. When you use dyn Trait, the vtable maps method names to their implementations for the concrete type. (Chapter 15)

WebAssembly (WASM) — A binary format for running code in web browsers. Nyx can compile to WASM with make wasm. (Chapter 24)

Work-stealing — A scheduling strategy where idle threads take tasks from busy threads' queues. Used by Nyx's M:N scheduler. (Chapter 23)

Worker pool — A fixed set of pre-spawned threads that process tasks from a shared queue. nyx-kv uses 128 workers. http_serve_mt uses a worker pool internally. (Chapter 18)

← Back to Table of Contents

← Previous: Appendix C: Common error messages Next: Appendix E: Syntax color standard →