Semantics API Reference
Generated from the /// XML doc comments in src/Ashes.Semantics/. See the Compilation Pipeline for how this project fits into the compiler. This page is regenerated by tools/docs-api-gen on every docs build — edit the doc comments in the source, not this file.
Types
| Type | Kind | Summary | Source |
|---|---|---|---|
AshesProject | record | A loaded ashes.json project: its entry point, source roots, output settings, and resolved dependencies. | source |
BuiltinRegistry | class | Static catalogue of the language's built-in modules, intrinsic value members, and built-in types. | source |
BuiltinRegistry.BuiltinConstructor | record | A data constructor of a built-in ADT, mirroring a user-declared ConstructorSymbol. | source |
BuiltinRegistry.BuiltinModule | record | A built-in module: either a pure intrinsic module whose members are compiler primitives, or a stdlib module backed by embedded Ashes source, or a hybrid of both. | source |
BuiltinRegistry.BuiltinModuleMember | record | A single intrinsic member exported by a built-in module. | source |
BuiltinRegistry.BuiltinType | record | A built-in type such as List, Maybe, or a resource type, exposed to binding as if user-declared. | source |
BuiltinRegistry.BuiltinValueKind | enum | Identifies a specific compiler intrinsic reachable as a built-in module member. | source |
CapabilityOperationSymbol | record | One operation of a declared capability. | source |
CapabilitySymbol | record | A declared capability: a named set of operations, optionally parameterized. | source |
CombinedCompilationLayout | record struct | The combined single-source view stitched together from all plan modules, together with the offset maps needed to translate diagnostics on the combined text back to their originating files. | source |
ConstructorSymbol | record | A resolved data constructor of an algebraic data type. | source |
CoroutineInfo | record | Metadata for a coroutine function generated from an async block. | source |
FfiType | record | Type of a value crossing the FFI boundary, describing how it is marshalled to and from C. | source |
FfiType.Bool | record | A boolean value. | source |
FfiType.Float | record | A 64-bit (double-precision) floating-point value. | source |
FfiType.Float32 | record | A 32-bit (single-precision) floating-point value. | source |
FfiType.Int | record | A signed 64-bit integer. | source |
FfiType.Opaque | record | An opaque handle type identified by Name, passed through unmodified. | source |
FfiType.Ptr | record | A pointer to Pointee. | source |
FfiType.Str | record | A string, marshalled as a NUL-terminated C string. | source |
FfiType.UInt | record | An unsigned integer of width Bits. | source |
FfiType.Void | record | No value (a void return). | source |
ImportSelector | record struct | A selector import (import M.name / import M.Type, optionally as alias) that brings a single exported binding or type into the importing module's scope unqualified . | source |
IrCompileTimeEval | class | Aggressive compile-time evaluation (partial evaluation) of pure IR. | source |
IrExternalFunction | record | A declared external (FFI) function: the Ashes-visible Name bound to the native symbol SymbolName with the given FFI signature. | source |
IrFunction | record | A lowered function: its label, its linear instruction stream, and the frame sizing and debug metadata the backend needs to emit it. | source |
IrInst | record | Base of the linear intermediate representation. | source |
IrInst.AddFloat | record | Floating-point addition Target = Left + Right. | source |
IrInst.AddInt | record | Integer addition Target = Left + Right, or a provisional + whose operand type was still unresolved (see DeferredType). | source |
IrInst.Alloc | record | Allocates a fixed-size buffer of SizeBytes and yields its pointer. | source |
IrInst.AllocAdt | record | Allocates a tagged ADT heap cell (layout per HeapLayouts.Adt) and yields its pointer. | source |
IrInst.AllocAdtStack | record | Stack-allocated form of AllocAdt for a non-escaping ADT cell. | source |
IrInst.AllocAdtToSpace | record | Like AllocAdt but allocates in the persistent "to-space" arena instead of the main per-iteration arena. | source |
IrInst.AllocReusing | record | In-place reuse: yields the cell at TokenTemp's address as Target, instead of allocating. | source |
IrInst.AllocStack | record | Stack-allocates a fixed-size buffer of SizeBytes and yields its pointer. | source |
IrInst.AndInt | record | Bitwise AND Target = Left & Right. | source |
IrInst.AsyncAll | record | Runs all tasks in a list to completion and collects results into a list. | source |
IrInst.AsyncRace | record | Runs the first task in a list to completion and returns its result. | source |
IrInst.AsyncSleep | record | Creates a sleep task that completes after the given number of milliseconds. | source |
IrInst.AwaitTask | record | Awaits a Task value inside a coroutine. | source |
IrInst.BigIntBinary | record | Binary BigInt arithmetic selected by Op. | source |
IrInst.BigIntCompare | record | Three-way BigInt comparison yielding a negative, zero, or positive Int. | source |
IrInst.BigIntFromInt | record | Widens an Int to a BigInt. | source |
IrInst.BigIntFromString | record | Parses a Str into Result(Str, BigInt). | source |
IrInst.BigIntToInt | record | Narrows a BigInt to Result(Str, Int), erroring when it does not fit an Int. | source |
IrInst.BigIntToString | record | Renders a BigInt to its decimal Str. | source |
IrInst.Borrow | record | Borrow instruction for compiler-inferred borrowing. | source |
IrInst.BytesAppend | record | Concatenates two byte buffers into Target. | source |
IrInst.BytesAppendByte | record | Appends a single byte to a buffer into Target. | source |
IrInst.BytesCompare | record | Three-way lexicographic comparison of two byte buffers into Target. | source |
IrInst.BytesEmpty | record | Yields the empty byte buffer into Target. | source |
IrInst.BytesFromList | record | Builds a byte buffer from a list of byte values into Target. | source |
IrInst.BytesGet | record | Reads the byte at IndexTemp from a buffer into Target. | source |
IrInst.BytesGetU16Le | record | Reads a little-endian 16-bit value at OffsetTemp from a buffer into Target. | source |
IrInst.BytesGetU32Le | record | Reads a little-endian 32-bit value at OffsetTemp from a buffer into Target. | source |
IrInst.BytesGetU64Le | record | Reads a little-endian 64-bit value at OffsetTemp from a buffer into Target. | source |
IrInst.BytesHash | record | Yields a hash of a byte buffer into Target. | source |
IrInst.BytesIndexOf | record | Finds the first occurrence of a needle in a buffer at or after FromTemp, yielding the index (or a sentinel) into Target. | source |
IrInst.BytesLength | record | Yields the length of a byte buffer into Target. | source |
IrInst.BytesScanHash | record | Scans for a needle in a buffer using a rolling hash from FromTemp, yielding the match index into Target. | source |
IrInst.BytesSingleton | record | Builds a one-byte buffer from ByteTemp into Target. | source |
IrInst.BytesSubText | record | Extracts a copied sub-range of a buffer as an owned value into Target. | source |
IrInst.BytesSubView | record | Produces a non-copying view over a sub-range of a buffer into Target. | source |
IrInst.BytesU16Le | record | Encodes a value as two little-endian bytes into Target. | source |
IrInst.BytesU32Le | record | Encodes a value as four little-endian bytes into Target. | source |
IrInst.BytesU64Le | record | Encodes a value as eight little-endian bytes into Target. | source |
IrInst.CallClosure | record | Invokes the closure in ClosureTemp with a single argument through its stored code pointer and environment. | source |
IrInst.CallExternal | record | Calls an external (FFI) function, marshalling arguments and the result per the declared FfiType signature. | source |
IrInst.CallKnown | record | Devirtualized closure call: the callee label is statically known, so codegen emits a direct call the LLVM inliner can see through. | source |
IrInst.CallLibm | record | Calls an openlibm transcendental symbol (e.g. | source |
IrInst.CleanupResource | record | Deterministic cleanup of a resource value. | source |
IrInst.CmpFloatEq | record | Floating-point equality Target = Left == Right. | source |
IrInst.CmpFloatGe | record | Floating-point "greater than or equal" comparison Target = Left >= Right. | source |
IrInst.CmpFloatGt | record | Floating-point "greater than" comparison Target = Left > Right. | source |
IrInst.CmpFloatLe | record | Floating-point "less than or equal" comparison Target = Left <= Right. | source |
IrInst.CmpFloatLt | record | Floating-point "less than" comparison Target = Left < Right. | source |
IrInst.CmpFloatNe | record | Floating-point inequality Target = Left != Right. | source |
IrInst.CmpIntEq | record | Integer equality Target = Left == Right, or a provisional == whose operand type was still unresolved (see DeferredType). | source |
IrInst.CmpIntGe | record | Signed integer "greater than or equal" comparison Target = Left >= Right. | source |
IrInst.CmpIntGt | record | Signed integer "greater than" comparison Target = Left > Right. | source |
IrInst.CmpIntLe | record | Signed integer "less than or equal" comparison Target = Left <= Right. | source |
IrInst.CmpIntLt | record | Signed integer "less than" comparison Target = Left < Right. | source |
IrInst.CmpIntNe | record | Integer inequality Target = Left != Right, or a provisional != whose operand type was still unresolved (see DeferredType). | source |
IrInst.CmpStrEq | record | String equality Target = Left == Right (byte-wise). | source |
IrInst.CmpStrNe | record | String inequality Target = Left != Right (byte-wise). | source |
IrInst.CmpUIntGe | record | Unsigned integer "greater than or equal" comparison Target = Left >= Right. | source |
IrInst.CmpUIntGt | record | Unsigned integer "greater than" comparison Target = Left > Right. | source |
IrInst.CmpUIntLe | record | Unsigned integer "less than or equal" comparison Target = Left <= Right. | source |
IrInst.CmpUIntLt | record | Unsigned integer "less than" comparison Target = Left < Right. | source |
IrInst.ConcatStr | record | String concatenation Target = Left ++ Right, allocating a fresh buffer. | source |
IrInst.ConcatStrTip | record | Affine-accumulator string append: semantically identical to ConcatStr, but the accumulator grows inside a loop-held reservation (start/end slots) instead of being copied per append, keeping total copy work linear. | source |
IrInst.ConsoleEnableRaw | record | Puts the terminal into raw mode, yielding a status/handle into Target. | source |
IrInst.ConsolePoll | record | Polls for terminal input up to TimeoutTemp milliseconds, yielding the available input into Target. | source |
IrInst.ConsoleRestore | record | Restores the terminal from raw mode, yielding a status into Target. | source |
IrInst.CopyFixedInto | record | In-place value-cell reuse: memcpys SizeBytes from SrcTemp into the already-persistent, same-size cell at DestTemp on the reuse/update path, keeping the value blob bounded. | source |
IrInst.CopyFixedIntoOrFresh | record | Fixed-size in-place-or-fresh value-cell reuse on the reuse/update path — the region-guarded form of CopyFixedInto. | source |
IrInst.CopyOutArena | record | Copies a heap object out of the arena to a fresh allocation, emitted AFTER RestoreArenaState but BEFORE ReclaimArenaChunks. | source |
IrInst.CopyOutArenaToSpace | record | Like CopyOutArena but the fresh copy is allocated in the persistent to-space (see AllocAdtToSpace) instead of the main arena. | source |
IrInst.CopyOutClosure | record | Copies a closure ({code, env, packed env size, dropper}) and its environment out of the arena to a fresh allocation. | source |
IrInst.CopyOutList | record | Deep-copies an entire cons-cell chain out of the arena to fresh allocations. | source |
IrInst.CopyOutPurpose | enum | Classifies every remaining copy-out so RC graph normalization cannot be confused with an arena lifetime fallback. | source |
IrInst.CopyOutTcoListCell | record | TCO-specific: copies a single cons cell (16 bytes) out of the arena and also copies the head value according to HeadCopy. | source |
IrInst.CopyStringIntoOrFresh | record | Variable-size in-place-or-fresh string/bytes value-cell reuse on the reuse/update path. | source |
IrInst.CreateCompletedTask | record | Creates an already-completed Task value. | source |
IrInst.CreateForkWorkersTask | record | Creates a leaf task that forks (CountTemp - 1) child processes for the fork-based multi-reactor (serveParallel), so CountTemp processes total each run their own reactor. | source |
IrInst.CreateHttpGetTask | record | Creates a leaf networking task for HTTP GET. | source |
IrInst.CreateHttpPostTask | record | Creates a leaf networking task for HTTP POST. | source |
IrInst.CreateTask | record | Creates a Task value by allocating a task/state struct and storing the coroutine function pointer and captured environment. | source |
IrInst.CreateTcpAcceptTask | record | Creates a leaf networking task for TCP accept (accept one connection from a listener). | source |
IrInst.CreateTcpCloseTask | record | Creates a leaf networking task for TCP close. | source |
IrInst.CreateTcpConnectTask | record | Creates a leaf networking task for TCP connect. | source |
IrInst.CreateTcpListenTask | record | Creates a leaf networking task for TCP listen (bind + listen on a local port). | source |
IrInst.CreateTcpReceiveTask | record | Creates a leaf networking task for TCP receive. | source |
IrInst.CreateTcpSendTask | record | Creates a leaf networking task for TCP send. | source |
IrInst.CreateTlsCloseTask | record | Creates a leaf networking task for closing a TLS session (close-notify flush + connection free). | source |
IrInst.CreateTlsConnectTask | record | Creates a staged networking task for TLS connect (TCP connect + TLS handshake). | source |
IrInst.CreateTlsHandshakeTask | record | Creates a leaf networking task for a TLS handshake on top of an existing TCP socket. | source |
IrInst.CreateTlsReceiveTask | record | Creates a leaf networking task for receiving text over a TLS session. | source |
IrInst.CreateTlsSendTask | record | Creates a leaf networking task for sending text over a TLS session. | source |
IrInst.CreateTlsServerHandshakeTask | record | Creates a leaf task that runs the SERVER half of a TLS handshake over an accepted TCP socket. | source |
IrInst.DivFloat | record | Floating-point division Target = Left / Right. | source |
IrInst.DivInt | record | Signed integer division Target = Left / Right. | source |
IrInst.DivUInt | record | Unsigned integer division Target = Left / Right. | source |
IrInst.DropReuse | record | Converts a dead ADT cell into an explicit reuse token. | source |
IrInst.FileClose | record | Closes an open file handle, yielding a status into Target. | source |
IrInst.FileExists | record | Tests whether a file exists, yielding a boolean into Target. | source |
IrInst.FileMmap | record | Memory-maps a file, yielding a bytes view into Target. | source |
IrInst.FileOpen | record | Opens a file, yielding a file handle into Target. | source |
IrInst.FileReadAllBytes | record | Reads a whole file as raw bytes into Target. | source |
IrInst.FileReadChunk | record | Reads up to CountTemp bytes from an open file handle into Target. | source |
IrInst.FileReadLine | record | Reads one line from an open file handle into Target. | source |
IrInst.FileReadText | record | Reads a whole file as text into Target. | source |
IrInst.FileWriteBytes | record | Writes a byte buffer to a file, yielding a status into Target. | source |
IrInst.FileWriteText | record | Writes text to a file, yielding a status into Target. | source |
IrInst.FloatToInt | record | Converts a float to an integer, truncating toward zero (fptosi). | source |
IrInst.FloatUnaryIntrinsic | record | Applies a unary LLVM math intrinsic to a float operand. | source |
IrInst.GetAdtField | record | Reads field FieldIndex of the ADT cell at Ptr into Target. | source |
IrInst.GetAdtTag | record | Reads the constructor tag from the ADT cell at Ptr into Target. | source |
IrInst.HttpGet | record | Performs a blocking HTTP GET, yielding the response into Target. | source |
IrInst.HttpPost | record | Performs a blocking HTTP POST, yielding the response into Target. | source |
IrInst.IntToFloat | record | Converts an integer to a float (sitofp). | source |
IrInst.Jump | record | Unconditionally branches to the Label named Target. | source |
IrInst.JumpIfFalse | record | Branches to Target when the boolean in CondTemp is false, otherwise falls through. | source |
IrInst.Label | record | Defines a branch target named Name in the instruction stream. | source |
IrInst.ListHeadCopyKind | enum | Describes how head values are handled during deep list copy-out. | source |
IrInst.LoadArgumentOwnership | record | Loads the hidden closure-call ownership flag. | source |
IrInst.LoadCapabilityHandler | record | Loads the current handler frame pointer for the capability with compile-time index CapabilityIndex from its module global (dynamically-scoped handler evidence). | source |
IrInst.LoadConstBool | record | Materializes the boolean literal Value into Target. | source |
IrInst.LoadConstFloat | record | Materializes the float literal Value into Target. | source |
IrInst.LoadConstInt | record | Materializes the integer literal Value into Target. | source |
IrInst.LoadConstStr | record | Loads a pointer to the interned string literal named StrLabel into Target. | source |
IrInst.LoadEnv | record | Reads the captured environment entry at Index (via the function's implicit environment pointer) into Target. | source |
IrInst.LoadFuncAddr | record | Loads the address of a lifted function as an i64. | source |
IrInst.LoadLocal | record | Reads the local variable in Slot into Target. | source |
IrInst.LoadMemOffset | record | Loads from memory at [BasePtr + OffsetBytes] into Target. | source |
IrInst.LoadParallelWorkerOverride | record | Loads the current dynamically-scoped worker override (the runtime global set by Ashes.Task.Parallel.withWorkers); 0 means "unset — use the compiled max". | source |
IrInst.LoadProgramArgs | record | Loads the program's command-line arguments (as a list of strings) into Target. | source |
IrInst.MakeClosure | record | Heap-allocates a closure object {code, env, packed env_size/result ownership, dropper} over the lifted function FuncLabel. | source |
IrInst.MakeClosureStack | record | Stack-allocated form of MakeClosure, used for a non-escaping closure whose lifetime is bounded by the current frame. | source |
IrInst.MonotonicMillis | record | Reads a monotonic clock value in milliseconds into Target. | source |
IrInst.MulFloat | record | Floating-point multiplication Target = Left * Right. | source |
IrInst.MulInt | record | Integer multiplication Target = Left * Right, or a provisional * whose operand type was still unresolved (see DeferredType). | source |
IrInst.NetTcpAccept | record | Accepts one connection from a listener socket, yielding the accepted socket into Target. | source |
IrInst.NetTcpClose | record | Closes a TCP socket, yielding a status into Target. | source |
IrInst.NetTcpConnect | record | Opens a blocking TCP connection, yielding a socket into Target. | source |
IrInst.NetTcpListen | record | Binds and listens on a local port, yielding a listener socket into Target. | source |
IrInst.NetTcpReceive | record | Receives up to MaxBytesTemp bytes from a TCP socket into Target. | source |
IrInst.NetTcpSend | record | Sends text over a TCP socket, yielding a status into Target. | source |
IrInst.OrInt | record | Bitwise OR Target = Left | Right. | source |
IrInst.PanicStr | record | Aborts execution with the message string in Source (an uncatchable panic). | source |
IrInst.ParallelCleanup | record | Releases the worker resources (stack, TCB, and arena chunks) for a finished ParallelFork; a no-op for the inline (un-spawned) case. | source |
IrInst.ParallelFork | record | Structured parallelism (Ashes.Task.Parallel.both). | source |
IrInst.ParallelJoin | record | Waits for the worker spawned by the matching ParallelFork to finish and yields its raw result pointer (in the worker's arena). | source |
IrInst.ParallelQueueAwait | record | Waits until the merge tree's root result has been published and yields its raw pointer (in some worker's arena, possibly referencing several). | source |
IrInst.ParallelQueueCleanup | record | Waits for every spawned queue worker to fully exit, then frees the workers' stacks, TCBs, and arena chunks plus the queue region itself. | source |
IrInst.ParallelQueueStart | record | Work-conserving parallel reduce (queued lowering of Ashes.Task.Parallel.reduce). | source |
IrInst.PrintBool | record | Writes the boolean in Source to standard output, followed by a newline. | source |
IrInst.PrintInt | record | Writes the integer in Source to standard output, followed by a newline. | source |
IrInst.PrintStr | record | Writes the string in Source to standard output, followed by a newline. | source |
IrInst.ProcessKill | record | Kills a child process, yielding a status into Target. | source |
IrInst.ProcessReadStderrLine | record | Reads one line from a child process's standard error into Target. | source |
IrInst.ProcessReadStdoutLine | record | Reads one line from a child process's standard output into Target. | source |
IrInst.ProcessWaitForExit | record | Waits for a child process to exit, yielding its exit code into Target. | source |
IrInst.ProcessWriteStdin | record | Writes text to a child process's standard input, yielding a status into Target. | source |
IrInst.RcDrop | record | Perceus lifetime marker for an ordinary owned heap value whose ownership dies here. | source |
IrInst.RcDup | record | Perceus lifetime marker for splitting ownership of an ordinary heap value. | source |
IrInst.RcIsUnique | record | Tests whether a runtime-managed value has exactly one owning reference. | source |
IrInst.ReadExact | record | Reads exactly CountTemp bytes from standard input into Target. | source |
IrInst.ReadLine | record | Reads one line from standard input into Target. | source |
IrInst.ReclaimArenaChunks | record | Frees OS chunks that were allocated between the saved watermark and the pre-restore heap state. | source |
IrInst.RegexCaptures | record | Finds the first match and returns its capture groups as Option(List(Option(Str))). | source |
IrInst.RegexCompile | record | Compiles a PCRE2 pattern, yielding a stable pcre2_code* handle (0 on error). | source |
IrInst.RegexCompileError | record | Compiles a PCRE2 pattern for validation only, yielding the empty string when valid or the diagnostic message otherwise. | source |
IrInst.RegexFind | record | Finds the first match of a compiled pattern at or after Start, yielding Option((Int, Int)) (match start/end offsets). | source |
IrInst.RegexSubstitute | record | Substitutes all matches of a compiled pattern in the subject, yielding the resulting Str. | source |
IrInst.RequestServerStop | record | Requests graceful whole-server shutdown (Stop.stop): rides the signal path on Linux (worker signals the parent, which forwards); sets the shutdown flag on Windows. | source |
IrInst.RestoreArenaState | record | Restores the heap allocator state (cursor and end pointers) from two local slots previously saved by SaveArenaState. | source |
IrInst.RestoreStackPointer | record | Resets the stack pointer to the value previously saved by SaveStackPointer into Slot. | source |
IrInst.Resume | record | State machine resume point: restores live variables from the state struct and loads the result from the awaited sub-task. | source |
IrInst.Return | record | Returns from the current function with the value in Source. | source |
IrInst.RunTask | record | Synchronously runs a task to completion, returning the result value. | source |
IrInst.SaveArenaState | record | Saves the current heap allocator state (cursor and end pointers) into two local slots. | source |
IrInst.SaveStackPointer | record | Saves the current stack pointer into a local slot at a TCO loop header, paired with RestoreStackPointer at each back-edge to free per-iteration stack scratch. | source |
IrInst.SetAdtField | record | Writes Source into field FieldIndex of the ADT cell at Ptr (offset via HeapLayouts.Adt.PayloadWordOffsetBytes). | source |
IrInst.SetDrainTimeout | record | Sets the graceful-shutdown drain bound (ms) for this process; yields unit. | source |
IrInst.ShlInt | record | Logical left shift Target = Left << Right. | source |
IrInst.ShrInt | record | Logical right shift Target = Left >> Right. | source |
IrInst.SpawnProcess | record | Spawns a child process, yielding a process handle into Target. | source |
IrInst.SpawnTask | record | Detaches a task for fire-and-forget cooperative execution (Ashes.Task.spawn). | source |
IrInst.StoreCapabilityHandler | record | Stores a handler frame pointer into the capability's module global. | source |
IrInst.StoreLocal | record | Writes the value in Source into local variable Slot. | source |
IrInst.StoreMemOffset | record | Stores Source to memory at [BasePtr + OffsetBytes]. | source |
IrInst.StoreParallelWorkerOverride | record | Stores a value into the worker-override global (0 clears it). | source |
IrInst.SubFloat | record | Floating-point subtraction Target = Left - Right. | source |
IrInst.SubInt | record | Integer subtraction Target = Left - Right. | source |
IrInst.Suspend | record | State machine suspend point: saves live variables to the state struct, stores the awaited sub-task, sets the next state index, and returns SUSPENDED. | source |
IrInst.SwitchTag | record | Multi-way dispatch on an ADT tag value (decision-tree pattern matching). | source |
IrInst.TcoResetPending | record | Placeholder for a TCO back-edge arena block whose copy-out decision could not be made at emission time (an operand type was still an unresolved inference variable). | source |
IrInst.TextAsciiCase | record | Maps ASCII letter case (upper/lower) across a string, leaving multibyte UTF-8 untouched. | source |
IrInst.TextByteLength | record | Yields the byte length of the string in TextTemp into Target. | source |
IrInst.TextFormatFloat | record | Renders a float to a string with a fixed number of decimals into Target. | source |
IrInst.TextFromFloat | record | Renders a float to its default string form into Target. | source |
IrInst.TextFromInt | record | Renders an integer to its decimal string into Target. | source |
IrInst.TextParseFloat | record | Parses a string as a float, yielding a result option into Target. | source |
IrInst.TextParseInt | record | Parses a string as an integer, yielding a result option into Target. | source |
IrInst.TextToHex | record | Renders an integer to its hexadecimal string into Target. | source |
IrInst.TextUncons | record | Splits a string into its first character and remainder, yielding an option into Target. | source |
IrInst.ToCString | record | Converts an Ashes string to a NUL-terminated C string pointer for FFI, into Target. | source |
IrInst.WriteStr | record | Writes the string in Source to standard output with no trailing newline. | source |
IrInst.XorInt | record | Bitwise XOR Target = Left ^ Right. | source |
IrOptimizer | class | IR-level optimization pass pipeline. | source |
IrProgram | record | The whole lowered program handed to the backend: the entry function, every other function, interned string literals, external declarations, and feature flags telling codegen which runtime facilities to link. | source |
IrStringLiteral | record | An interned string constant: Value addressed by Label and loaded via LoadConstStr. | source |
Lowering | class | Lowers the parsed AST to typed IR: binding and scope resolution, Hindley-Milner type inference, and the ownership and borrowing analysis that drives deterministic destruction. | source |
Lowering.HoverTypeInfo | record struct | The inferred type of a source span, recorded during lowering so the language server can answer hover and type-at-position queries. | source |
ParsedImportHeader | record struct | The result of splitting a module's import header from its body: ParseImportHeader returns the imported names, the body source with the header removed, and the alias and selector import tables. | source |
ProjectCompilationPlan | record | A fully resolved build plan: the modules to compile in dependency order, the designated entry module, and the merged import surface. | source |
ProjectModule | record | One source module participating in a compilation plan, with its imports already parsed out of the source. | source |
ProjectSupport | class | Multi-file project support: discovers and loads ashes.json projects, parses import headers, resolves the standard library and inline modules, orders modules by dependency, and stitches them into a single combined compilation unit for the frontend. | source |
ProjectSupport.InlineModuleInfo | record | Public view of a lifted inline module for consumers outside this class (kept minimal). | source |
ProjectSupport.MappedDiagnostic | record struct | A diagnostic mapped from combined-source coordinates back to a user-visible location: the owning file, and — when the region is position-preserving — a span rebased into the entry file's original text. | source |
ResolvedDependency | record | A dependency resolved to concrete source roots on disk, imported under its namespace. | source |
SourceLocation | record struct | A source position attached to IR for debug-info (DWARF) emission. | source |
StateMachineResult | record | Result of the state machine transform applied to a coroutine's instruction list. | source |
StateMachineTransform | class | Transforms a linear list of IR instructions (from an async body) into a state-machine form. | source |
TaskStructLayout | class | Fixed header offsets in the task/state struct (each slot is 8 bytes). | source |
TypeParameterSymbol | record | A bound generic type parameter of a type or capability declaration. | source |
TypeRef | record | Base of the resolved type representation used throughout semantics, lowering, and the backend. | source |
TypeRef.TBigInt | record | The arbitrary-precision signed integer type (BigInt). | source |
TypeRef.TBool | record | The boolean type (Bool). | source |
TypeRef.TBytes | record | The immutable byte-buffer type (Bytes), sharing TStr's heap layout. | source |
TypeRef.TCapability | record | One capability instance inside a row: the declared capability plus its type arguments (e.g. | source |
TypeRef.TFloat | record | The 64-bit IEEE-754 floating-point type (Float). | source |
TypeRef.TFun | record | A function (arrow) type from Arg to Ret, optionally carrying a capability Row. | source |
TypeRef.TInt | record | The signed 64-bit integer type (Int). | source |
TypeRef.TList | record | An immutable singly-linked list type with element type Element. | source |
TypeRef.TNamedType | record | A reference to a user-declared or built-in named type applied to TypeArgs (e.g. | source |
TypeRef.TNever | record | The uninhabited bottom type, the result of a diverging or panic expression. | source |
TypeRef.TOpaque | record | An opaque externally-defined type identified only by Name, used for FFI handles the compiler treats abstractly. | source |
TypeRef.TPtr | record | A raw pointer to Pointee, used at the FFI boundary and in low-level intrinsics. | source |
TypeRef.TRow | record | An capability row: a set of capabilities plus a tail. | source |
TypeRef.TStr | record | The immutable UTF-8 string type (Str). | source |
TypeRef.TTuple | record | A fixed-arity tuple type over Elements. | source |
TypeRef.TTypeParam | record | A rigid (universally-quantified) type parameter bound in an enclosing declaration. | source |
TypeRef.TUInt | record | An unsigned integer type whose width is Bits. | source |
TypeRef.TVar | record | An unresolved unification variable produced during Hindley-Milner inference, identified by Id. | source |
TypeScheme | record | A polytype for let-polymorphism: `forall Quantified. | source |
TypeSymbol | record | A resolved type declaration: its name, generic parameters, and data constructors. | source |
TypeVar | record | A named type variable bound by a TypeScheme quantifier. | source |
Lowering
Lowers the parsed AST to typed IR: binding and scope resolution, Hindley-Milner type inference, and the ownership and borrowing analysis that drives deterministic destruction. Implemented across the Lowering.* partial files; this one holds borrow inference for resource arguments.
| Member | Signature | Summary |
|---|---|---|
ConstructorSymbols | IReadOnlyDictionary<string, ConstructorSymbol> ConstructorSymbols | The data constructors registered during lowering, keyed by constructor name. |
FormatType | string FormatType(TypeRef type) | Renders type in the canonical human-readable form used for hovers and diagnostics. |
GetTypeAtPosition | HoverTypeInfo? GetTypeAtPosition(int position) | Returns the narrowest recorded HoverTypeInfo whose span contains position, or null when no recorded type covers that offset. Used by the language server for hover and type-at-cursor. |
LastLoweredType | TypeRef? LastLoweredType | The inferred type of the most recently lowered expression, exposed for tooling queries. |
Lower | IrProgram Lower(Program program) | Lowers a complete parsed Program (its declarations and trailing expression) into the typed IR, running binding, Hindley-Milner inference, and ownership analysis. This is the primary entry point for compiling a source unit. |
Lower | IrProgram Lower(Expr expr) | Lowers a bare trailing expression (a program with no top-level declarations) into the typed IR, the single-expression counterpart to Lower. |
PublicApiCapabilities | IReadOnlyList<string> PublicApiCapabilities() | The capability names appearing in the types of the package's exported (top-level) bindings after lowering — the static, inference-based capability audit surface. Call after Lower. Reads the inferred types, not the bodies, so a capability discharged by an in-body handler is correctly absent; it is over-approximation-safe in the other direction (a capability anywhere in an exported binding's resolved type is reported), which is the safe bias for a supply-chain audit. |
ResolveTypeName | TypeRef ResolveTypeName(string name, IReadOnlyList<TypeRef>? typeArgs = null) | Resolves a written type name and optional type arguments to a TypeRef, handling built-in primitives, declared and built-in named types, and type parameters. Reports a diagnostic and yields TNever on arity mismatch or an unknown name. |
ResolvedTypes | IReadOnlyDictionary<string, TNamedType> ResolvedTypes | The resolved named types encountered during lowering, keyed by type name. |
SetSourceContext | void SetSourceContext(string filePath, string sourceText) | Sets source context for debug info tagging. Call before Lower() so that emitted IR instructions carry source locations. |
SetSourceContext | void SetSourceContext(CombinedCompilationLayout layout) | Sets multi-file source context using a CombinedCompilationLayout so that emitted IR instructions carry per-file source locations. |
TypeSymbols | IReadOnlyDictionary<string, TypeSymbol> TypeSymbols | The type declarations registered during lowering, keyed by type name. |
ProjectSupport
Multi-file project support: discovers and loads ashes.json projects, parses import headers, resolves the standard library and inline modules, orders modules by dependency, and stitches them into a single combined compilation unit for the frontend.
| Member | Signature | Summary |
|---|---|---|
BuildCompilationLayout | CombinedCompilationLayout BuildCompilationLayout(ProjectCompilationPlan plan, string? entrySourceOverride = null) | Stitches every module of plan into one combined compilation unit, lifting any inline modules in the entry source, and returns the source together with the offset maps that translate diagnostics back to their originating files. entrySourceOverride substitutes replacement text for the entry module when provided (e.g. for the language server). |
BuildCompilationPlan | ProjectCompilationPlan BuildCompilationPlan(AshesProject project) | Resolves all modules reachable from project's entry file, validates their imports, orders them so dependencies precede dependents, and returns the ProjectCompilationPlan the combined-source builders consume. |
BuildCompilationSource | string BuildCompilationSource(ProjectCompilationPlan plan) | Convenience wrapper over BuildCompilationLayout that returns only the stitched combined source text for plan. |
BuildStandaloneCompilationLayout | CombinedCompilationLayout BuildStandaloneCompilationLayout(string sourceWithoutImports, IReadOnlyList<string> importNames, string entryFilePath = "<memory>", IReadOnlyList<ImportSelector>? selectors = null) | Builds a combined compilation layout for a single standalone file (no ashes.json), pulling in only the standard-library modules named by importNames. sourceWithoutImports is the file body with its import header already removed, entryFilePath labels it in diagnostics, and selectors carries any selector imports to apply. |
CachePathFor | string CachePathFor(string ns, string version, string hash) | The cache directory for a specific package version: cache/pkg/<ns>/<version>/<hashkey>. |
ContainsInlineModule | bool ContainsInlineModule(string source) | Whether a source contains an inline module Name = ... declaration header. |
DiscoverProjectFile | string? DiscoverProjectFile(string startDirectory) | Walks upward from startDirectory looking for an ashes.json file, returning its path when found or null when no project file exists in any ancestor directory. |
ExpandInlineModules | (string OuterSource, IReadOnlyList<InlineModuleInfo> InlineModules) ExpandInlineModules(string source, string scopeModuleName, string displayPath) | Lifts inline module Name = ... blocks out of an (imports-stripped) module source. The enclosing source is returned with each block removed and every bare inline qualifier rewritten to its file-composed path; each block is returned as an InlineModule with the same rewrites applied recursively for nesting. scopeModuleName is the composed path of the scope being expanded (the file module name at the top level). |
ImportModulePattern | string ImportModulePattern | Regex matching a single import line: a dotted module path, an optional selector leaf, and an optional as alias. Exposed so other phases match import syntax identically. |
IsStdModule | bool IsStdModule(string moduleName) | Returns true when moduleName names a standard-library module. |
KnownStandardLibraryModules | IReadOnlyCollection<string> KnownStandardLibraryModules | The names of every standard-library module recognized when resolving imports. |
LoadProject | AshesProject LoadProject(string projectPath) | Parses the ashes.json at projectPath into an AshesProject, resolving its entry file, source roots, and output settings. Throws when the file is missing or not a valid project object. |
MapDiagnosticsToOriginal | IReadOnlyList<MappedDiagnostic> MapDiagnosticsToOriginal(CombinedCompilationLayout layout, IReadOnlyList<DiagnosticEntry> entries, string entryFilePath, string entryOriginalSource, string entryStrippedSource) | Maps diagnostic spans from combined-source offsets (what compilation ran on) back to the entry file's original text, so errors render at the coordinates the user sees. The entry region of the combined source is line/column-preserving with respect to the original file (imports and hoisted declarations are blanked keeping newlines; alias preludes overwrite blank lines), so entry-region spans map by line/column rather than byte offset. Hoisted entry declarations map exactly via EntryTypeDeclFragments. Spans inside a stitched (reconstructed) module region cannot be positioned — they are attributed to the owning file with HasPosition = false. |
PackageCacheRoot | string PackageCacheRoot() | Root of the shared content-addressed package cache ($XDG_CACHE_HOME/ashes, else ~/.cache/ashes). Both the CLI (writing) and the compiler (reading) compute paths the same way. |
ParseImportHeader | ParsedImportHeader ParseImportHeader(string source, string displayPath) | Splits source into its leading import header and remaining body, returning the imported module names, alias table, selector imports, and the body with the header removed. displayPath names the file in any diagnostics raised for malformed imports. |
PascalCase | string PascalCase(string name) | Map a package name to its default namespace (e.g. json-parser → JsonParser). |
SanitizeModuleBindingName | string SanitizeModuleBindingName(string moduleName) | Turns a dotted module name into an identifier-safe binding name by replacing each . with an underscore, so a module can be referenced as a single mangled symbol. |
TryInferExportName | string? TryInferExportName(string source) | Infers the single name a module exports by inspecting its trailing expression: a let x = ... in x / let recursive x = ... in x spine or a bare x yields x. Returns null when the source fails to parse or has no single inferable export. |
BuiltinRegistry
Static catalogue of the language's built-in modules, intrinsic value members, and built-in types. Binding and lowering consult it to resolve qualified Ashes.* references, decide which module members are compiler intrinsics versus stdlib source, classify types for the memory model (copy / owned / resource), and validate selector imports against built-in modules.
| Member | Signature | Summary |
|---|---|---|
IsBuiltinModule | bool IsBuiltinModule(string moduleName) | Returns true when moduleName names one of the compiler's built-in modules. |
IsCopyType | bool IsCopyType(TypeRef prunedType) | Returns true if the given type is a copy type (stack-allocated, trivially duplicated). Copy types: Int, Float, Bool. Copy types do NOT get Drop instructions. |
IsOwnedType | bool IsOwnedType(TypeRef prunedType) | Returns true if the given type is an owned type (heap-allocated, requires cleanup). Owned types: String, List, Tuple, Function (closures), named types (ADTs incl. resources). Owned types get Drop instructions at scope exit. |
IsReservedModuleNamespace | bool IsReservedModuleNamespace(string moduleName) | Returns true when moduleName falls under the reserved Ashes namespace, so user code may not declare a module there. |
IsReservedTypeName | bool IsReservedTypeName(string typeName) | Returns true when typeName is reserved by the compiler (the Ashes name, a built-in type, or a built-in primitive), so user code may not redeclare it. |
IsResourceTypeName | bool IsResourceTypeName(string typeName) | Returns true if the given type name is classified as a resource type. Resource types require deterministic cleanup (Drop) at scope exit. |
ModuleExportsName | bool ModuleExportsName(string moduleName, string name) | Returns true when the named built-in module exports the given name. Returns false for unknown modules and for names the module does not export. |
StandardModuleNames | IReadOnlyCollection<string> StandardModuleNames | The fully qualified names of every built-in module the compiler recognizes. |
TryGetModule | bool TryGetModule(string moduleName, out BuiltinModule module) | Looks up a built-in module by its fully qualified name, returning true and its descriptor in module when found, false otherwise. |
TryGetModuleExports | bool TryGetModuleExports(string moduleName, out IReadOnlySet<string> exportNames) | Surfaces the set of names a built-in module exports (its public value bindings and types), so the import resolver can validate selector imports such as import Ashes.IO.print against built-in modules with the same query it uses for user modules. Returns false when the module is not a known built-in module. |
TryGetPrimitiveType | bool TryGetPrimitiveType(string typeName, out TypeRef type) | Resolves a built-in primitive type name (Float or Bytes) to its TypeRef, returning true and the type in type when recognized, false otherwise. |
TryGetType | bool TryGetType(string typeName, out BuiltinType type) | Looks up a built-in type by name, returning true and its descriptor in type when found, false otherwise. |
Types | IReadOnlyCollection<BuiltinType> Types | Every built-in type descriptor, seeded into scope so binding treats them as declared. |
