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§
- Bound
Var - A name bound in a pattern or let-expression.
- External
Sig - 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.
- Term
Flags - 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.
- Variant
Id - The id of a variant inside an enum.
- Visited
Expr - Information about an expression after it has been fully visited in RuleVisitor::add_expr.
Enums§
- Builtin
Type - A built-in type.
- Constructor
Kind - The kind of a constructor for a term.
- Expr
- A right-hand side expression of some rule.
- Extractor
Kind - 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.
- Return
Kind - How many values a function can return.
- Term
Kind - The kind of a term.
- Type
- A type.
Traits§
- Expr
Visitor - Visitor interface for Exprs. Visitors can return an arbitrary identifier for each subexpression, which is threaded through to subsequent calls into the visitor.
- Pattern
Visitor - Visitor interface for Patterns. Visitors can assign an arbitrary identifier to each subpattern, which is threaded through to subsequent calls into the visitor.
- Rule
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.