Skip to content

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

TypeKindSummarySource
AshesProjectrecordA loaded ashes.json project: its entry point, source roots, output settings, and resolved dependencies.source
BuiltinRegistryclassStatic catalogue of the language's built-in modules, intrinsic value members, and built-in types.source
BuiltinRegistry.BuiltinConstructorrecordA data constructor of a built-in ADT, mirroring a user-declared ConstructorSymbol.source
BuiltinRegistry.BuiltinModulerecordA 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.BuiltinModuleMemberrecordA single intrinsic member exported by a built-in module.source
BuiltinRegistry.BuiltinTyperecordA built-in type such as List, Maybe, or a resource type, exposed to binding as if user-declared.source
BuiltinRegistry.BuiltinValueKindenumIdentifies a specific compiler intrinsic reachable as a built-in module member.source
CapabilityOperationSymbolrecordOne operation of a declared capability.source
CapabilitySymbolrecordA declared capability: a named set of operations, optionally parameterized.source
CombinedCompilationLayoutrecord structThe 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
ConstructorSymbolrecordA resolved data constructor of an algebraic data type.source
CoroutineInforecordMetadata for a coroutine function generated from an async block.source
FfiTyperecordType of a value crossing the FFI boundary, describing how it is marshalled to and from C.source
FfiType.BoolrecordA boolean value.source
FfiType.FloatrecordA 64-bit (double-precision) floating-point value.source
FfiType.Float32recordA 32-bit (single-precision) floating-point value.source
FfiType.IntrecordA signed 64-bit integer.source
FfiType.OpaquerecordAn opaque handle type identified by Name, passed through unmodified.source
FfiType.PtrrecordA pointer to Pointee.source
FfiType.StrrecordA string, marshalled as a NUL-terminated C string.source
FfiType.UIntrecordAn unsigned integer of width Bits.source
FfiType.VoidrecordNo value (a void return).source
ImportSelectorrecord structA 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
IrCompileTimeEvalclassAggressive compile-time evaluation (partial evaluation) of pure IR.source
IrExternalFunctionrecordA declared external (FFI) function: the Ashes-visible Name bound to the native symbol SymbolName with the given FFI signature.source
IrFunctionrecordA lowered function: its label, its linear instruction stream, and the frame sizing and debug metadata the backend needs to emit it.source
IrInstrecordBase of the linear intermediate representation.source
IrInst.AddFloatrecordFloating-point addition Target = Left + Right.source
IrInst.AddIntrecordInteger addition Target = Left + Right, or a provisional + whose operand type was still unresolved (see DeferredType).source
IrInst.AllocrecordAllocates a fixed-size buffer of SizeBytes and yields its pointer.source
IrInst.AllocAdtrecordAllocates a tagged ADT heap cell (layout per HeapLayouts.Adt) and yields its pointer.source
IrInst.AllocAdtStackrecordStack-allocated form of AllocAdt for a non-escaping ADT cell.source
IrInst.AllocAdtToSpacerecordLike AllocAdt but allocates in the persistent "to-space" arena instead of the main per-iteration arena.source
IrInst.AllocReusingrecordIn-place reuse: yields the cell at TokenTemp's address as Target, instead of allocating.source
IrInst.AllocStackrecordStack-allocates a fixed-size buffer of SizeBytes and yields its pointer.source
IrInst.AndIntrecordBitwise AND Target = Left & Right.source
IrInst.AsyncAllrecordRuns all tasks in a list to completion and collects results into a list.source
IrInst.AsyncRacerecordRuns the first task in a list to completion and returns its result.source
IrInst.AsyncSleeprecordCreates a sleep task that completes after the given number of milliseconds.source
IrInst.AwaitTaskrecordAwaits a Task value inside a coroutine.source
IrInst.BigIntBinaryrecordBinary BigInt arithmetic selected by Op.source
IrInst.BigIntComparerecordThree-way BigInt comparison yielding a negative, zero, or positive Int.source
IrInst.BigIntFromIntrecordWidens an Int to a BigInt.source
IrInst.BigIntFromStringrecordParses a Str into Result(Str, BigInt).source
IrInst.BigIntToIntrecordNarrows a BigInt to Result(Str, Int), erroring when it does not fit an Int.source
IrInst.BigIntToStringrecordRenders a BigInt to its decimal Str.source
IrInst.BorrowrecordBorrow instruction for compiler-inferred borrowing.source
IrInst.BytesAppendrecordConcatenates two byte buffers into Target.source
IrInst.BytesAppendByterecordAppends a single byte to a buffer into Target.source
IrInst.BytesComparerecordThree-way lexicographic comparison of two byte buffers into Target.source
IrInst.BytesEmptyrecordYields the empty byte buffer into Target.source
IrInst.BytesFromListrecordBuilds a byte buffer from a list of byte values into Target.source
IrInst.BytesGetrecordReads the byte at IndexTemp from a buffer into Target.source
IrInst.BytesGetU16LerecordReads a little-endian 16-bit value at OffsetTemp from a buffer into Target.source
IrInst.BytesGetU32LerecordReads a little-endian 32-bit value at OffsetTemp from a buffer into Target.source
IrInst.BytesGetU64LerecordReads a little-endian 64-bit value at OffsetTemp from a buffer into Target.source
IrInst.BytesHashrecordYields a hash of a byte buffer into Target.source
IrInst.BytesIndexOfrecordFinds the first occurrence of a needle in a buffer at or after FromTemp, yielding the index (or a sentinel) into Target.source
IrInst.BytesLengthrecordYields the length of a byte buffer into Target.source
IrInst.BytesScanHashrecordScans for a needle in a buffer using a rolling hash from FromTemp, yielding the match index into Target.source
IrInst.BytesSingletonrecordBuilds a one-byte buffer from ByteTemp into Target.source
IrInst.BytesSubTextrecordExtracts a copied sub-range of a buffer as an owned value into Target.source
IrInst.BytesSubViewrecordProduces a non-copying view over a sub-range of a buffer into Target.source
IrInst.BytesU16LerecordEncodes a value as two little-endian bytes into Target.source
IrInst.BytesU32LerecordEncodes a value as four little-endian bytes into Target.source
IrInst.BytesU64LerecordEncodes a value as eight little-endian bytes into Target.source
IrInst.CallClosurerecordInvokes the closure in ClosureTemp with a single argument through its stored code pointer and environment.source
IrInst.CallExternalrecordCalls an external (FFI) function, marshalling arguments and the result per the declared FfiType signature.source
IrInst.CallKnownrecordDevirtualized closure call: the callee label is statically known, so codegen emits a direct call the LLVM inliner can see through.source
IrInst.CallLibmrecordCalls an openlibm transcendental symbol (e.g.source
IrInst.CleanupResourcerecordDeterministic cleanup of a resource value.source
IrInst.CmpFloatEqrecordFloating-point equality Target = Left == Right.source
IrInst.CmpFloatGerecordFloating-point "greater than or equal" comparison Target = Left >= Right.source
IrInst.CmpFloatGtrecordFloating-point "greater than" comparison Target = Left > Right.source
IrInst.CmpFloatLerecordFloating-point "less than or equal" comparison Target = Left <= Right.source
IrInst.CmpFloatLtrecordFloating-point "less than" comparison Target = Left < Right.source
IrInst.CmpFloatNerecordFloating-point inequality Target = Left != Right.source
IrInst.CmpIntEqrecordInteger equality Target = Left == Right, or a provisional == whose operand type was still unresolved (see DeferredType).source
IrInst.CmpIntGerecordSigned integer "greater than or equal" comparison Target = Left >= Right.source
IrInst.CmpIntGtrecordSigned integer "greater than" comparison Target = Left > Right.source
IrInst.CmpIntLerecordSigned integer "less than or equal" comparison Target = Left <= Right.source
IrInst.CmpIntLtrecordSigned integer "less than" comparison Target = Left < Right.source
IrInst.CmpIntNerecordInteger inequality Target = Left != Right, or a provisional != whose operand type was still unresolved (see DeferredType).source
IrInst.CmpStrEqrecordString equality Target = Left == Right (byte-wise).source
IrInst.CmpStrNerecordString inequality Target = Left != Right (byte-wise).source
IrInst.CmpUIntGerecordUnsigned integer "greater than or equal" comparison Target = Left >= Right.source
IrInst.CmpUIntGtrecordUnsigned integer "greater than" comparison Target = Left > Right.source
IrInst.CmpUIntLerecordUnsigned integer "less than or equal" comparison Target = Left <= Right.source
IrInst.CmpUIntLtrecordUnsigned integer "less than" comparison Target = Left < Right.source
IrInst.ConcatStrrecordString concatenation Target = Left ++ Right, allocating a fresh buffer.source
IrInst.ConcatStrTiprecordAffine-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.ConsoleEnableRawrecordPuts the terminal into raw mode, yielding a status/handle into Target.source
IrInst.ConsolePollrecordPolls for terminal input up to TimeoutTemp milliseconds, yielding the available input into Target.source
IrInst.ConsoleRestorerecordRestores the terminal from raw mode, yielding a status into Target.source
IrInst.CopyFixedIntorecordIn-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.CopyFixedIntoOrFreshrecordFixed-size in-place-or-fresh value-cell reuse on the reuse/update path — the region-guarded form of CopyFixedInto.source
IrInst.CopyOutArenarecordCopies a heap object out of the arena to a fresh allocation, emitted AFTER RestoreArenaState but BEFORE ReclaimArenaChunks.source
IrInst.CopyOutArenaToSpacerecordLike CopyOutArena but the fresh copy is allocated in the persistent to-space (see AllocAdtToSpace) instead of the main arena.source
IrInst.CopyOutClosurerecordCopies a closure ({code, env, packed env size, dropper}) and its environment out of the arena to a fresh allocation.source
IrInst.CopyOutListrecordDeep-copies an entire cons-cell chain out of the arena to fresh allocations.source
IrInst.CopyOutPurposeenumClassifies every remaining copy-out so RC graph normalization cannot be confused with an arena lifetime fallback.source
IrInst.CopyOutTcoListCellrecordTCO-specific: copies a single cons cell (16 bytes) out of the arena and also copies the head value according to HeadCopy.source
IrInst.CopyStringIntoOrFreshrecordVariable-size in-place-or-fresh string/bytes value-cell reuse on the reuse/update path.source
IrInst.CreateCompletedTaskrecordCreates an already-completed Task value.source
IrInst.CreateForkWorkersTaskrecordCreates 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.CreateHttpGetTaskrecordCreates a leaf networking task for HTTP GET.source
IrInst.CreateHttpPostTaskrecordCreates a leaf networking task for HTTP POST.source
IrInst.CreateTaskrecordCreates a Task value by allocating a task/state struct and storing the coroutine function pointer and captured environment.source
IrInst.CreateTcpAcceptTaskrecordCreates a leaf networking task for TCP accept (accept one connection from a listener).source
IrInst.CreateTcpCloseTaskrecordCreates a leaf networking task for TCP close.source
IrInst.CreateTcpConnectTaskrecordCreates a leaf networking task for TCP connect.source
IrInst.CreateTcpListenTaskrecordCreates a leaf networking task for TCP listen (bind + listen on a local port).source
IrInst.CreateTcpReceiveTaskrecordCreates a leaf networking task for TCP receive.source
IrInst.CreateTcpSendTaskrecordCreates a leaf networking task for TCP send.source
IrInst.CreateTlsCloseTaskrecordCreates a leaf networking task for closing a TLS session (close-notify flush + connection free).source
IrInst.CreateTlsConnectTaskrecordCreates a staged networking task for TLS connect (TCP connect + TLS handshake).source
IrInst.CreateTlsHandshakeTaskrecordCreates a leaf networking task for a TLS handshake on top of an existing TCP socket.source
IrInst.CreateTlsReceiveTaskrecordCreates a leaf networking task for receiving text over a TLS session.source
IrInst.CreateTlsSendTaskrecordCreates a leaf networking task for sending text over a TLS session.source
IrInst.CreateTlsServerHandshakeTaskrecordCreates a leaf task that runs the SERVER half of a TLS handshake over an accepted TCP socket.source
IrInst.DivFloatrecordFloating-point division Target = Left / Right.source
IrInst.DivIntrecordSigned integer division Target = Left / Right.source
IrInst.DivUIntrecordUnsigned integer division Target = Left / Right.source
IrInst.DropReuserecordConverts a dead ADT cell into an explicit reuse token.source
IrInst.FileCloserecordCloses an open file handle, yielding a status into Target.source
IrInst.FileExistsrecordTests whether a file exists, yielding a boolean into Target.source
IrInst.FileMmaprecordMemory-maps a file, yielding a bytes view into Target.source
IrInst.FileOpenrecordOpens a file, yielding a file handle into Target.source
IrInst.FileReadAllBytesrecordReads a whole file as raw bytes into Target.source
IrInst.FileReadChunkrecordReads up to CountTemp bytes from an open file handle into Target.source
IrInst.FileReadLinerecordReads one line from an open file handle into Target.source
IrInst.FileReadTextrecordReads a whole file as text into Target.source
IrInst.FileWriteBytesrecordWrites a byte buffer to a file, yielding a status into Target.source
IrInst.FileWriteTextrecordWrites text to a file, yielding a status into Target.source
IrInst.FloatToIntrecordConverts a float to an integer, truncating toward zero (fptosi).source
IrInst.FloatUnaryIntrinsicrecordApplies a unary LLVM math intrinsic to a float operand.source
IrInst.GetAdtFieldrecordReads field FieldIndex of the ADT cell at Ptr into Target.source
IrInst.GetAdtTagrecordReads the constructor tag from the ADT cell at Ptr into Target.source
IrInst.HttpGetrecordPerforms a blocking HTTP GET, yielding the response into Target.source
IrInst.HttpPostrecordPerforms a blocking HTTP POST, yielding the response into Target.source
IrInst.IntToFloatrecordConverts an integer to a float (sitofp).source
IrInst.JumprecordUnconditionally branches to the Label named Target.source
IrInst.JumpIfFalserecordBranches to Target when the boolean in CondTemp is false, otherwise falls through.source
IrInst.LabelrecordDefines a branch target named Name in the instruction stream.source
IrInst.ListHeadCopyKindenumDescribes how head values are handled during deep list copy-out.source
IrInst.LoadArgumentOwnershiprecordLoads the hidden closure-call ownership flag.source
IrInst.LoadCapabilityHandlerrecordLoads the current handler frame pointer for the capability with compile-time index CapabilityIndex from its module global (dynamically-scoped handler evidence).source
IrInst.LoadConstBoolrecordMaterializes the boolean literal Value into Target.source
IrInst.LoadConstFloatrecordMaterializes the float literal Value into Target.source
IrInst.LoadConstIntrecordMaterializes the integer literal Value into Target.source
IrInst.LoadConstStrrecordLoads a pointer to the interned string literal named StrLabel into Target.source
IrInst.LoadEnvrecordReads the captured environment entry at Index (via the function's implicit environment pointer) into Target.source
IrInst.LoadFuncAddrrecordLoads the address of a lifted function as an i64.source
IrInst.LoadLocalrecordReads the local variable in Slot into Target.source
IrInst.LoadMemOffsetrecordLoads from memory at [BasePtr + OffsetBytes] into Target.source
IrInst.LoadParallelWorkerOverriderecordLoads the current dynamically-scoped worker override (the runtime global set by Ashes.Task.Parallel.withWorkers); 0 means "unset — use the compiled max".source
IrInst.LoadProgramArgsrecordLoads the program's command-line arguments (as a list of strings) into Target.source
IrInst.MakeClosurerecordHeap-allocates a closure object {code, env, packed env_size/result ownership, dropper} over the lifted function FuncLabel.source
IrInst.MakeClosureStackrecordStack-allocated form of MakeClosure, used for a non-escaping closure whose lifetime is bounded by the current frame.source
IrInst.MonotonicMillisrecordReads a monotonic clock value in milliseconds into Target.source
IrInst.MulFloatrecordFloating-point multiplication Target = Left * Right.source
IrInst.MulIntrecordInteger multiplication Target = Left * Right, or a provisional * whose operand type was still unresolved (see DeferredType).source
IrInst.NetTcpAcceptrecordAccepts one connection from a listener socket, yielding the accepted socket into Target.source
IrInst.NetTcpCloserecordCloses a TCP socket, yielding a status into Target.source
IrInst.NetTcpConnectrecordOpens a blocking TCP connection, yielding a socket into Target.source
IrInst.NetTcpListenrecordBinds and listens on a local port, yielding a listener socket into Target.source
IrInst.NetTcpReceiverecordReceives up to MaxBytesTemp bytes from a TCP socket into Target.source
IrInst.NetTcpSendrecordSends text over a TCP socket, yielding a status into Target.source
IrInst.OrIntrecordBitwise OR Target = Left | Right.source
IrInst.PanicStrrecordAborts execution with the message string in Source (an uncatchable panic).source
IrInst.ParallelCleanuprecordReleases the worker resources (stack, TCB, and arena chunks) for a finished ParallelFork; a no-op for the inline (un-spawned) case.source
IrInst.ParallelForkrecordStructured parallelism (Ashes.Task.Parallel.both).source
IrInst.ParallelJoinrecordWaits for the worker spawned by the matching ParallelFork to finish and yields its raw result pointer (in the worker's arena).source
IrInst.ParallelQueueAwaitrecordWaits 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.ParallelQueueCleanuprecordWaits for every spawned queue worker to fully exit, then frees the workers' stacks, TCBs, and arena chunks plus the queue region itself.source
IrInst.ParallelQueueStartrecordWork-conserving parallel reduce (queued lowering of Ashes.Task.Parallel.reduce).source
IrInst.PrintBoolrecordWrites the boolean in Source to standard output, followed by a newline.source
IrInst.PrintIntrecordWrites the integer in Source to standard output, followed by a newline.source
IrInst.PrintStrrecordWrites the string in Source to standard output, followed by a newline.source
IrInst.ProcessKillrecordKills a child process, yielding a status into Target.source
IrInst.ProcessReadStderrLinerecordReads one line from a child process's standard error into Target.source
IrInst.ProcessReadStdoutLinerecordReads one line from a child process's standard output into Target.source
IrInst.ProcessWaitForExitrecordWaits for a child process to exit, yielding its exit code into Target.source
IrInst.ProcessWriteStdinrecordWrites text to a child process's standard input, yielding a status into Target.source
IrInst.RcDroprecordPerceus lifetime marker for an ordinary owned heap value whose ownership dies here.source
IrInst.RcDuprecordPerceus lifetime marker for splitting ownership of an ordinary heap value.source
IrInst.RcIsUniquerecordTests whether a runtime-managed value has exactly one owning reference.source
IrInst.ReadExactrecordReads exactly CountTemp bytes from standard input into Target.source
IrInst.ReadLinerecordReads one line from standard input into Target.source
IrInst.ReclaimArenaChunksrecordFrees OS chunks that were allocated between the saved watermark and the pre-restore heap state.source
IrInst.RegexCapturesrecordFinds the first match and returns its capture groups as Option(List(Option(Str))).source
IrInst.RegexCompilerecordCompiles a PCRE2 pattern, yielding a stable pcre2_code* handle (0 on error).source
IrInst.RegexCompileErrorrecordCompiles a PCRE2 pattern for validation only, yielding the empty string when valid or the diagnostic message otherwise.source
IrInst.RegexFindrecordFinds the first match of a compiled pattern at or after Start, yielding Option((Int, Int)) (match start/end offsets).source
IrInst.RegexSubstituterecordSubstitutes all matches of a compiled pattern in the subject, yielding the resulting Str.source
IrInst.RequestServerStoprecordRequests 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.RestoreArenaStaterecordRestores the heap allocator state (cursor and end pointers) from two local slots previously saved by SaveArenaState.source
IrInst.RestoreStackPointerrecordResets the stack pointer to the value previously saved by SaveStackPointer into Slot.source
IrInst.ResumerecordState machine resume point: restores live variables from the state struct and loads the result from the awaited sub-task.source
IrInst.ReturnrecordReturns from the current function with the value in Source.source
IrInst.RunTaskrecordSynchronously runs a task to completion, returning the result value.source
IrInst.SaveArenaStaterecordSaves the current heap allocator state (cursor and end pointers) into two local slots.source
IrInst.SaveStackPointerrecordSaves 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.SetAdtFieldrecordWrites Source into field FieldIndex of the ADT cell at Ptr (offset via HeapLayouts.Adt.PayloadWordOffsetBytes).source
IrInst.SetDrainTimeoutrecordSets the graceful-shutdown drain bound (ms) for this process; yields unit.source
IrInst.ShlIntrecordLogical left shift Target = Left << Right.source
IrInst.ShrIntrecordLogical right shift Target = Left >> Right.source
IrInst.SpawnProcessrecordSpawns a child process, yielding a process handle into Target.source
IrInst.SpawnTaskrecordDetaches a task for fire-and-forget cooperative execution (Ashes.Task.spawn).source
IrInst.StoreCapabilityHandlerrecordStores a handler frame pointer into the capability's module global.source
IrInst.StoreLocalrecordWrites the value in Source into local variable Slot.source
IrInst.StoreMemOffsetrecordStores Source to memory at [BasePtr + OffsetBytes].source
IrInst.StoreParallelWorkerOverriderecordStores a value into the worker-override global (0 clears it).source
IrInst.SubFloatrecordFloating-point subtraction Target = Left - Right.source
IrInst.SubIntrecordInteger subtraction Target = Left - Right.source
IrInst.SuspendrecordState 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.SwitchTagrecordMulti-way dispatch on an ADT tag value (decision-tree pattern matching).source
IrInst.TcoResetPendingrecordPlaceholder 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.TextAsciiCaserecordMaps ASCII letter case (upper/lower) across a string, leaving multibyte UTF-8 untouched.source
IrInst.TextByteLengthrecordYields the byte length of the string in TextTemp into Target.source
IrInst.TextFormatFloatrecordRenders a float to a string with a fixed number of decimals into Target.source
IrInst.TextFromFloatrecordRenders a float to its default string form into Target.source
IrInst.TextFromIntrecordRenders an integer to its decimal string into Target.source
IrInst.TextParseFloatrecordParses a string as a float, yielding a result option into Target.source
IrInst.TextParseIntrecordParses a string as an integer, yielding a result option into Target.source
IrInst.TextToHexrecordRenders an integer to its hexadecimal string into Target.source
IrInst.TextUnconsrecordSplits a string into its first character and remainder, yielding an option into Target.source
IrInst.ToCStringrecordConverts an Ashes string to a NUL-terminated C string pointer for FFI, into Target.source
IrInst.WriteStrrecordWrites the string in Source to standard output with no trailing newline.source
IrInst.XorIntrecordBitwise XOR Target = Left ^ Right.source
IrOptimizerclassIR-level optimization pass pipeline.source
IrProgramrecordThe 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
IrStringLiteralrecordAn interned string constant: Value addressed by Label and loaded via LoadConstStr.source
LoweringclassLowers 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.HoverTypeInforecord structThe inferred type of a source span, recorded during lowering so the language server can answer hover and type-at-position queries.source
ParsedImportHeaderrecord structThe 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
ProjectCompilationPlanrecordA fully resolved build plan: the modules to compile in dependency order, the designated entry module, and the merged import surface.source
ProjectModulerecordOne source module participating in a compilation plan, with its imports already parsed out of the source.source
ProjectSupportclassMulti-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.InlineModuleInforecordPublic view of a lifted inline module for consumers outside this class (kept minimal).source
ProjectSupport.MappedDiagnosticrecord structA 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
ResolvedDependencyrecordA dependency resolved to concrete source roots on disk, imported under its namespace.source
SourceLocationrecord structA source position attached to IR for debug-info (DWARF) emission.source
StateMachineResultrecordResult of the state machine transform applied to a coroutine's instruction list.source
StateMachineTransformclassTransforms a linear list of IR instructions (from an async body) into a state-machine form.source
TaskStructLayoutclassFixed header offsets in the task/state struct (each slot is 8 bytes).source
TypeParameterSymbolrecordA bound generic type parameter of a type or capability declaration.source
TypeRefrecordBase of the resolved type representation used throughout semantics, lowering, and the backend.source
TypeRef.TBigIntrecordThe arbitrary-precision signed integer type (BigInt).source
TypeRef.TBoolrecordThe boolean type (Bool).source
TypeRef.TBytesrecordThe immutable byte-buffer type (Bytes), sharing TStr's heap layout.source
TypeRef.TCapabilityrecordOne capability instance inside a row: the declared capability plus its type arguments (e.g.source
TypeRef.TFloatrecordThe 64-bit IEEE-754 floating-point type (Float).source
TypeRef.TFunrecordA function (arrow) type from Arg to Ret, optionally carrying a capability Row.source
TypeRef.TIntrecordThe signed 64-bit integer type (Int).source
TypeRef.TListrecordAn immutable singly-linked list type with element type Element.source
TypeRef.TNamedTyperecordA reference to a user-declared or built-in named type applied to TypeArgs (e.g.source
TypeRef.TNeverrecordThe uninhabited bottom type, the result of a diverging or panic expression.source
TypeRef.TOpaquerecordAn opaque externally-defined type identified only by Name, used for FFI handles the compiler treats abstractly.source
TypeRef.TPtrrecordA raw pointer to Pointee, used at the FFI boundary and in low-level intrinsics.source
TypeRef.TRowrecordAn capability row: a set of capabilities plus a tail.source
TypeRef.TStrrecordThe immutable UTF-8 string type (Str).source
TypeRef.TTuplerecordA fixed-arity tuple type over Elements.source
TypeRef.TTypeParamrecordA rigid (universally-quantified) type parameter bound in an enclosing declaration.source
TypeRef.TUIntrecordAn unsigned integer type whose width is Bits.source
TypeRef.TVarrecordAn unresolved unification variable produced during Hindley-Milner inference, identified by Id.source
TypeSchemerecordA polytype for let-polymorphism: `forall Quantified.source
TypeSymbolrecordA resolved type declaration: its name, generic parameters, and data constructors.source
TypeVarrecordA 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.

MemberSignatureSummary
ConstructorSymbolsIReadOnlyDictionary<string, ConstructorSymbol> ConstructorSymbolsThe data constructors registered during lowering, keyed by constructor name.
FormatTypestring FormatType(TypeRef type)Renders type in the canonical human-readable form used for hovers and diagnostics.
GetTypeAtPositionHoverTypeInfo? 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.
LastLoweredTypeTypeRef? LastLoweredTypeThe inferred type of the most recently lowered expression, exposed for tooling queries.
LowerIrProgram 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.
LowerIrProgram 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.
PublicApiCapabilitiesIReadOnlyList<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.
ResolveTypeNameTypeRef 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.
ResolvedTypesIReadOnlyDictionary<string, TNamedType> ResolvedTypesThe resolved named types encountered during lowering, keyed by type name.
SetSourceContextvoid SetSourceContext(string filePath, string sourceText)Sets source context for debug info tagging. Call before Lower() so that emitted IR instructions carry source locations.
SetSourceContextvoid SetSourceContext(CombinedCompilationLayout layout)Sets multi-file source context using a CombinedCompilationLayout so that emitted IR instructions carry per-file source locations.
TypeSymbolsIReadOnlyDictionary<string, TypeSymbol> TypeSymbolsThe 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.

MemberSignatureSummary
BuildCompilationLayoutCombinedCompilationLayout 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).
BuildCompilationPlanProjectCompilationPlan 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.
BuildCompilationSourcestring BuildCompilationSource(ProjectCompilationPlan plan)Convenience wrapper over BuildCompilationLayout that returns only the stitched combined source text for plan.
BuildStandaloneCompilationLayoutCombinedCompilationLayout 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.
CachePathForstring CachePathFor(string ns, string version, string hash)The cache directory for a specific package version: cache/pkg/<ns>/<version>/<hashkey>.
ContainsInlineModulebool ContainsInlineModule(string source)Whether a source contains an inline module Name = ... declaration header.
DiscoverProjectFilestring? 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).
ImportModulePatternstring ImportModulePatternRegex 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.
IsStdModulebool IsStdModule(string moduleName)Returns true when moduleName names a standard-library module.
KnownStandardLibraryModulesIReadOnlyCollection<string> KnownStandardLibraryModulesThe names of every standard-library module recognized when resolving imports.
LoadProjectAshesProject 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.
MapDiagnosticsToOriginalIReadOnlyList<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.
PackageCacheRootstring 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.
ParseImportHeaderParsedImportHeader 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.
PascalCasestring PascalCase(string name)Map a package name to its default namespace (e.g. json-parserJsonParser).
SanitizeModuleBindingNamestring 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.
TryInferExportNamestring? 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.

MemberSignatureSummary
IsBuiltinModulebool IsBuiltinModule(string moduleName)Returns true when moduleName names one of the compiler's built-in modules.
IsCopyTypebool 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.
IsOwnedTypebool 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.
IsReservedModuleNamespacebool IsReservedModuleNamespace(string moduleName)Returns true when moduleName falls under the reserved Ashes namespace, so user code may not declare a module there.
IsReservedTypeNamebool 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.
IsResourceTypeNamebool 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.
ModuleExportsNamebool 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.
StandardModuleNamesIReadOnlyCollection<string> StandardModuleNamesThe fully qualified names of every built-in module the compiler recognizes.
TryGetModulebool 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.
TryGetModuleExportsbool 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.
TryGetPrimitiveTypebool 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.
TryGetTypebool 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.
TypesIReadOnlyCollection<BuiltinType> TypesEvery built-in type descriptor, seeded into scope so binding treats them as declared.