cranelift_isle

Module sema

Source
Expand description

Semantic analysis.

This module primarily contains the type environment and term environment.

The type environment is constructed by analyzing an input AST. The type environment records the types used in the input source and the types of our various rules and symbols. ISLE’s type system is intentionally easy to check, only requires a single pass over the AST, and doesn’t require any unification or anything like that.

The term environment is constructed from both the AST and type environment. It is sort of a typed and reorganized AST that more directly reflects ISLE semantics than the input ISLE source code (where as the AST is the opposite).

Structs§

BoundVar
A name bound in a pattern or let-expression.
ExternalSig
An external function signature.
Field
A field of a Variant.
FieldId
The id of a field inside a variant.
IfLet
An if-let clause with a subpattern match on an expr after the main LHS matches.
Rule
A term rewrite rule.
RuleId
The id of an interned rule inside the TermEnv.
Sym
The id of an interned symbol.
Term
A term.
TermEnv
The term environment.
TermFlags
Flags from a term’s declaration with (decl ...).
TermId
The id of an interned term inside the TermEnv.
TypeEnv
The type environment.
TypeId
The id of an interned type inside the TypeEnv.
VarId
The id of a bound variable inside a Bindings.
Variant
A variant of an enum.
VariantId
The id of a variant inside an enum.
VisitedExpr
Information about an expression after it has been fully visited in RuleVisitor::add_expr.

Enums§

BuiltinType
A built-in type.
ConstructorKind
The kind of a constructor for a term.
Expr
A right-hand side expression of some rule.
ExtractorKind
The kind of an extractor for a term.
IntType
A built-in fixed-width integer type.
Pattern
A left-hand side pattern of some rule.
ReturnKind
How many values a function can return.
TermKind
The kind of a term.
Type
A type.

Traits§

ExprVisitor
Visitor interface for Exprs. Visitors can return an arbitrary identifier for each subexpression, which is threaded through to subsequent calls into the visitor.
PatternVisitor
Visitor interface for Patterns. Visitors can assign an arbitrary identifier to each subpattern, which is threaded through to subsequent calls into the visitor.
RuleVisitor
Visitor interface for Rules. Visitors must be able to visit patterns by implementing PatternVisitor, and to visit expressions by providing a type that implements ExprVisitor.