Module cranelift_isle::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 envionment. 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§
- A name bound in a pattern or let-expression.
- An external function signature.
- A field of a
Variant
. - The id of a field inside a variant.
- An
if-let
clause with a subpattern match on an expr after the main LHS matches. - A term rewrite rule.
- The id of an interned rule inside the
TermEnv
. - The id of an interned symbol.
- A term.
- The term environment.
- Flags from a term’s declaration with
(decl ...)
. - The id of an interned term inside the
TermEnv
. - The type environment.
- The id of an interned type inside the
TypeEnv
. - The id of a bound variable inside a
Bindings
. - A variant of an enum.
- The id of a variant inside an enum.
- Information about an expression after it has been fully visited in RuleVisitor::add_expr.
Enums§
- The kind of a constructor for a term.
- A right-hand side expression of some rule.
- The kind of an extractor for a term.
- A left-hand side pattern of some rule.
- How many values a function can return.
- The kind of a term.
- A type.
Traits§
- Visitor interface for Exprs. Visitors can return an arbitrary identifier for each subexpression, which is threaded through to subsequent calls into the visitor.
- Visitor interface for Patterns. Visitors can assign an arbitrary identifier to each subpattern, which is threaded through to subsequent calls into the visitor.
- 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.