Skip to content

Frontend API Reference

Generated from the /// XML doc comments in src/Ashes.Frontend/. 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
AstSpansclassA side table mapping AST nodes to their originating source spans.source
CapabilityDeclrecordA capability declaration: capability Clock = | now : Unit -> Int.source
CapabilityOperationrecordOne operation of a capability declaration: | now : Unit -> Int or a bare | log.source
CapabilityRefSyntaxrecordA single capability reference inside a uses row: Clock or State(Int).source
CompileDiagnosticExceptionclassThrown to abort compilation when one or more diagnostics have been collected.source
DiagnosticCodesclassThe stable ASHnnn string codes attached to compiler diagnostics, used for cross-referencing with the diagnostics reference and for machine-readable filtering.source
DiagnosticEntryrecordA single compiler diagnostic: a source Span, a human-readable Message, and an optional Code from DiagnosticCodes.source
DiagnosticTextRendererclassRenders structured compiler diagnostics into human-readable, rustc-style text with a path:line:column header and, when the source is available, a caret-underlined snippet of the offending line.source
DiagnosticsclassA collecting sink for compiler diagnostics.source
ExprrecordBase of the expression AST.source
Expr.AddrecordInteger/float addition, Left + Right.source
Expr.AwaitrecordAn await expression that suspends until a task completes.source
Expr.BigIntLitrecordAn arbitrary-precision integer literal (an N-suffixed number).source
Expr.BitwiseAndrecordBitwise and, Left & Right.source
Expr.BitwiseNotrecordBitwise complement, ~Operand.source
Expr.BitwiseOrrecordBitwise or, Left | Right.source
Expr.BitwiseXorrecordBitwise xor, Left ^ Right.source
Expr.BoolLitrecordA boolean literal.source
Expr.CallrecordFunction application, f(x) or f x.source
Expr.ConsrecordA cons cell, Head :: Tail, prepending an element onto a list.source
Expr.DividerecordDivision, Left / Right.source
Expr.EqualrecordEquality comparison, Left == Right.source
Expr.FloatLitrecordA floating-point literal, carrying both its numeric value and the source text so the formatter can round-trip the exact written form.source
Expr.GreaterOrEqualrecordGreater-or-equal comparison, Left >= Right.source
Expr.GreaterThanrecordGreater-than comparison, Left > Right.source
Expr.HandlerecordHandler installation: handle body with | Capability.op(args) -> arm | return(r) -> arm.source
Expr.IfrecordA conditional, if Cond then Then else Else.source
Expr.IntLitrecordA signed integer literal.source
Expr.LambdarecordA single-parameter lambda, given (x) -> expr.source
Expr.LessOrEqualrecordLess-or-equal comparison, Left <= Right.source
Expr.LessThanrecordLess-than comparison, Left < Right.source
Expr.LetrecordA non-recursive binding, let Name = Value in Body.source
Expr.LetRecursiverecordA self-recursive binding, let recursive Name = Value in Body, where Name is in scope within its own Value.source
Expr.LetResultrecordA result-unwrapping binding, let? Name = Value in Body: binds the ok value of Value, short-circuiting the whole expression on error.source
Expr.ListLitrecordA list literal, [a, b, ...].source
Expr.MatchrecordA pattern match, `match Value with | ...source
Expr.ModulorecordModulo, Left % Right.source
Expr.MultiplyrecordMultiplication, Left * Right.source
Expr.NotEqualrecordInequality comparison, Left != Right.source
Expr.PerformrecordExplicit capability-operation marker: perform Clock.now(x).source
Expr.QualifiedVarrecordA module-qualified name reference, Module.Name.source
Expr.RecordLitrecordRecord literal: TypeName { field1 = e1, field2 = e2 }.source
Expr.RecordUpdaterecordRecord update: { expr with field1 = e1, field2 = e2 }.source
Expr.ResultMapErrorPiperecordResult-map-error pipe, Left |!> Right: maps the error value of Left through Right, passing ok values through.source
Expr.ResultPiperecordResult-pipe, Left |?> Right: threads the ok value of Left into Right, short-circuiting on error.source
Expr.ShiftLeftrecordLeft shift, Left << Right.source
Expr.ShiftRightrecordRight shift, Left >> Right.source
Expr.StrLitrecordA string literal.source
Expr.SubtractrecordSubtraction, Left - Right (also the desugared form of unary minus).source
Expr.TupleLitrecordA tuple literal, (a, b, ...).source
Expr.UIntLitrecordAn unsigned fixed-width integer literal (e.g.source
Expr.VarrecordA reference to an unqualified name.source
ExternalDeclrecordAn external declaration: a foreign function or opaque type imported from native code via the FFI surface.source
ExternalDecl.FunctionrecordAn external function binding, external name(params) -> ret [= "symbol"].source
ExternalDecl.OpaqueTyperecordAn opaque external type whose representation is unknown to the compiler, external type Name.source
HandlerArmrecordOne arm of a `handle ...source
LexerclassForward-only tokenizer that turns source text into a stream of Token values, one per Next call.source
MatchCaserecord structOne arm of a Match: a pattern, its result expression, and an optional when guard.source
NeedsRowSyntaxrecordA written uses row: uses {A, B} (closed), uses {A, B | e} (open), or uses e (open, no required capabilities).source
ParsedTyperecordA type as written in an external FFI signature.source
ParsedType.NamedrecordA named FFI type, e.g.source
ParsedType.PointerrecordA pointer to another FFI type, written *T.source
ParserclassRecursive-descent parser that turns a source string into an AST.source
PatternrecordBase of the pattern AST used in match arms and irrefutable let bindings.source
Pattern.BoolLitrecordA boolean-literal pattern.source
Pattern.ConsrecordA cons pattern, Head :: Tail, matching a non-empty list.source
Pattern.ConstructorrecordA constructor pattern, Name(p1, ...), matching an ADT variant.source
Pattern.EmptyListrecordThe empty-list pattern, [].source
Pattern.IntLitrecordAn integer-literal pattern.source
Pattern.StrLitrecordA string-literal pattern.source
Pattern.TuplerecordA tuple pattern, (p1, p2, ...).source
Pattern.VarrecordA variable pattern that always matches and binds the value to a name.source
Pattern.WildcardrecordThe wildcard pattern, _, that matches anything without binding.source
ProgramrecordA whole compilation unit: an ordered sequence of top-level items followed by an optional trailing expression.source
ProvideBindingrecordOne operation implementation in a provide: | compare = Ashes.Text.compare.source
ProvideDeclrecordA static provider: provide Ord(Str) = | compare = ....source
SourceTextUtilsclassLine/column computation utilities shared between Semantics (IR tagging) and LSP (editor integration).source
TextSpanrecord structA half-open range of character offsets into a source string, used to locate diagnostics and AST nodes.source
Tokenrecord structA single lexical token: its Kind, the exact source Text it spanned, decoded numeric payloads, and the source position it occupied.source
TokenKindenumThe lexical category of a Token: keywords, operators, punctuation, literal kinds, and the end-of-input and error sentinels.source
TopLevelItemrecordA single top-level item, kept in source order.source
TopLevelItem.CapabilityrecordA top-level capability declaration.source
TopLevelItem.ExternalrecordA top-level external declaration.source
TopLevelItem.LetDeclrecordA top-level value binding: let Name = Value, or let rec when IsRecursive.source
TopLevelItem.ProviderecordA top-level provide declaration (static capability satisfaction).source
TopLevelItem.RecursiveGrouprecordA mutual-recursion group: `let rec A = ...source
TopLevelItem.TyperecordA top-level type declaration.source
TypeConstructorrecordOne constructor of a type declaration (also the single synthetic constructor of a record type).source
TypeDeclrecordA type declaration: an algebraic data type or (when IsRecord) a record type.source
TypeExprrecordA type expression written by the user in an annotation, e.g.source
TypeExpr.AppliedrecordA parameterised type application: List(Int), Result(Str, Int).source
TypeExpr.ArrowrecordA function type: Int -> Str, optionally carrying a capability row: Str -> Int uses {Prices}.source
TypeExpr.NamedrecordA simple named type or type parameter: Int, Str, T.source
TypeExpr.TupleTyperecordA tuple type: (Int, Str).source
TypeExpr.UnitTyperecordUnit written as an empty tuple: ().source
TypeExprExtensionsclassHelpers over TypeExpr trees.source
TypeParameterrecordA declared type parameter, e.g.source

Parser

Recursive-descent parser that turns a source string into an AST. It drives a forward-only Lexer, reports recoverable errors into a Diagnostics sink rather than throwing, and produces either a full Program (ParseProgram) or a single Expr (ParseExpression).

MemberSignatureSummary
ParseExpressionExpr ParseExpression()Parses the input as a single expression and verifies that no tokens remain afterward. Used for contexts that expect one expression rather than a whole compilation unit (e.g. the REPL).
ParseProgramProgram ParseProgram()Parses a whole compilation unit — an ordered sequence of top-level declarations followed by an optional trailing expression (declaration* expr?) — into a Program. Imports are assumed stripped upstream. A file with no declarations must be a single expression.

Lexer

Forward-only tokenizer that turns source text into a stream of Token values, one per Next call. It skips whitespace and // line comments, recognizes keywords, operators, and literals (integer, unsigned-suffixed, float, big-int, string), and reports lexical errors into a Diagnostics sink. SavePosition / RestorePosition give the parser bounded backtracking.

MemberSignatureSummary
NextToken Next()Scans and returns the next token, advancing past it. Whitespace and // line comments are skipped first; at end of input a EOF token is returned.
RestorePositionvoid RestorePosition(int pos)Rewinds the lexer to a position previously returned by SavePosition.
SavePositionint SavePosition()Captures the current byte offset so it can later be handed back to RestorePosition for bounded lookahead/backtracking.