Skip to main content

Crate bock_ast

Crate bock_ast 

Source
Expand description

Bock AST — abstract syntax tree node definitions for the Bock language.

Every syntactic construct in the Bock grammar maps to a type in this crate. All nodes carry a NodeId (for compiler bookkeeping) and a Span (for diagnostics and error reporting).

Modules§

visitor
Visitor trait for AST traversal.

Structs§

Annotation
A decorator-style annotation such as @derive(Equatable) or @performance(max_latency: 100).
AnnotationArg
A single argument to an annotation, optionally labelled.
Arg
A named argument in a function call: label: value.
AssociatedType
An associated type inside a trait declaration.
Block
A block of statements with an optional tail expression.
ClassDecl
A class declaration.
ConstDecl
A const NAME: Type = value declaration.
EffectDecl
An algebraic effect declaration.
EnumDecl
An enum (algebraic data type) declaration.
FileId
Identifies a source file within the compilation session.
FnDecl
A function declaration.
ForLoop
for pattern in iterable { body }.
GenericParam
A single generic type parameter, e.g. T or T: Bound.
GuardStmt
guard (condition) else { diverging_block }.
HandlerPair
A handler pair inside a handling block: Log with handler.
HandlingBlock
handling (Effect with handler, ...) { body }.
Ident
An identifier token with its source span.
ImplBlock
An impl Trait for Type or impl Type block.
ImportDecl
An import declaration.
ImportedName
One named item in an import list.
LetStmt
let [mut] pattern [: Type] = value.
LoopStmt
loop { body }.
MatchArm
One arm of a match expression.
Module
The root AST node for a single Bock source file.
ModuleHandleDecl
A module-level handle Effect with handler declaration.
ModulePath
A module path declared at the top of a file, e.g. module Std.Io.
Param
A single function parameter.
PropertyBinding
A binding in a forall clause of a property test.
PropertyTestDecl
A property("name") { forall(...) { ... } } property-based test declaration.
RecordDecl
A record (value-type) declaration.
RecordDeclField
A field in a record declaration.
RecordField
One field in a record construction expression.
RecordPatternField
One field binding inside a record pattern.
RecordSpread
A spread element in record construction: ..defaults.
Span
A byte-offset span within a source file.
TraitDecl
A trait declaration (or platform-trait when is_platform is true).
TypeAliasDecl
A type Name = Type where (predicate) alias.
TypeAssignment
A type assignment inside an impl block: type Output = Int.
TypeConstraint
A where clause constraint, e.g. T: Equatable.
TypePath
A qualified path of identifiers separated by ., e.g. Std.Io.File.
WhileLoop
while (condition) { body }.

Enums§

AssignOp
An assignment operator.
BinOp
A binary operator.
EnumVariant
A single enum variant.
Expr
An expression node.
ImportItems
The items selected from an import.
InterpolationPart
One segment of a string interpolation: either raw text or an embedded expression.
Item
A top-level item in a source file.
Literal
A literal value as it appears in source.
Pattern
A destructuring pattern used in let, match, for, etc.
Stmt
A statement node.
TypeExpr
A syntactic type expression as it appears in source code.
UnaryOp
A unary operator.
Visibility
Declaration visibility.

Functions§

strip_type_suffix
Strip a type suffix (e.g., _u8, _f64) from a numeric literal string.

Type Aliases§

NodeId
Unique identifier for an AST node within a compilation session.