Aver

March 17, 2026 · View on GitHub

Compiler types

TypeLocationDescription
TokenKindsrc/lexer.rsEvery possible token: literals, keywords, operators, structural (INDENT/DEDENT/NEWLINE/EOF)
Tokensrc/lexer.rsTokenKind + source position (line, col)
LexerErrorsrc/lexer.rsCarry msg, line, col; formatted as "Lexer error [L:C]: msg"
ParseErrorsrc/parser/core.rsmsg, line, col; formatted as "Parse error [L:C]: msg"

AST types

TypeLocationDescription
Literalsrc/ast.rsInt(i64), Float(f64), Str(String), Bool(bool)
BinOpsrc/ast.rsArithmetic and comparison operators as enum variants
Patternsrc/ast.rsMatch arm pattern: Wildcard, Literal, Ident, EmptyList, Cons, Constructor
StrPartsrc/ast.rsPiece of an interpolated string: Literal(String) or Parsed(Box<Expr>)
Exprsrc/ast.rsEvery expression form: Literal, Ident, Resolved(u16), Attr, FnCall, BinOp, Match, Constructor, ErrorProp, InterpolatedStr, List(Vec<Expr>), Tuple(Vec<Expr>), MapLiteral(Vec<(Expr, Expr)>), RecordCreate { type_name, fields }, RecordUpdate { type_name, base, updates }, TailCall(Box<(String, Vec<Expr>)>)
Stmtsrc/ast.rsBinding(name, Option<type_ann>, expr), Expr(expr)
FnBodysrc/ast.rsBlock(Vec<Stmt>) for parsed source; Expr(Expr) remains as an internal compact form used by some compiler/codegen tests
FnDefsrc/ast.rsName, params, return type, effects, optional description, body
Modulesrc/ast.rsName + source line, depends, exposes, exposes_opaque, intent string
VerifyBlocksrc/ast.rsFunction name + list of (left_expr, right_expr) equality cases
DecisionBlocksrc/ast.rsName + source line, date, reason, chosen ref, rejected refs, impacts refs, optional author
DecisionImpactsrc/ast.rsReusable decision reference: Symbol(String) (validated identifier) or Semantic(String) (free-form text)
TopLevelsrc/ast.rsTop-level item: Module, FnDef, Verify, Decision, Stmt, TypeDef (plus legacy EffectSet placeholder for removed syntax)
TypeDefsrc/ast.rsSum { name, variants: Vec<TypeVariant> } or Product { name, fields: Vec<(String, String)> }

Runtime types

TypeLocationDescription
Valuesrc/value.rsRuntime value: Int, Float, Str, Bool, Unit, Ok(Box<Value>), Err(Box<Value>), Some(Box<Value>), None, List(AverList<Value>), Fn{..}, Builtin(String), Variant { type_name, variant, fields }, Record { type_name, fields }, Namespace { name, members }
Envsrc/value.rsVec<EnvFrame> — scope stack (Owned(HashMap) or Slots(Vec<Rc<Value>>)), innermost last
RuntimeErrorsrc/value.rsError enum: Error(String), ErrProp(Box<Value>), TailCall(Box<(String, Vec<Value>)>), ReplayMismatch(String), ReplayExhausted