Protocols
The following protocols are available globally.
-
The description of a core trait that has been loaded in an AST.
See moreDeclaration
Swift
public protocol CoreTraitDescription : Decodable, Encodable, Sendable -
A type that is notified when nodes are entered and left during an AST traversal.
Use this protocol to implement algorithms that must traverse all or most AST nodes and perform similar operations on each of them. Instances of types implementing this protocol are meant to be passed as argument to
AST.walk(_:notifying:).For example:
struct V: ASTWalkObserver { var outermostFunctions: [FunctionDecl.ID] = [] mutating func willEnter(_ n: AnyNodeID, in ast: AST) -> Bool { if let d = FunctionDecl.ID(n) { outermostFunctions.append(d) return false } else { return true } } } var v = V() for m in ast.modules { ast.walk(m, notifying: &v) } print(v.outermostFunctions)This program prints the IDs of the outermost function declarations in
See moreast.Declaration
Swift
public protocol ASTWalkObserver : Sendable -
A declaration bundle.
See moreDeclaration
Swift
public protocol BundleDecl : ExposableDecl -
The declaration of an entity that may capture bindings.
See moreDeclaration
Swift
public protocol CapturingDecl : Decl, LexicalScope -
The declaration of a type’s conformance to one or multiple traits.
See moreDeclaration
Swift
public protocol ConformanceSource : ExposableDecl -
A generic declaration.
See moreDeclaration
Swift
public protocol GenericDecl : GenericScope -
A declaration that extends a type.
See moreDeclaration
Swift
public protocol TypeExtendingDecl : ExposableDecl, GenericScope -
A value expression.
Declaration
Swift
public protocol Expr : Node -
An AST node that outlines a generic lexical scope.
See moreDeclaration
Swift
public protocol GenericScope : Decl, LexicalScope -
An AST node that outlines a lexical scope.
Declaration
Swift
public protocol LexicalScope -
A protocol describing the API of an AST node.
See moreDeclaration
Swift
public protocol Node : Decodable, Encodable, Sendable -
The ID of a declaration.
See moreDeclaration
Swift
public protocol DeclID : NodeIDProtocol -
The ID of a value expression.
See moreDeclaration
Swift
public protocol ExprID : NodeIDProtocol -
A type denoting the ID of a node.
See moreDeclaration
Swift
public protocol NodeIDProtocol : CustomStringConvertible, Decodable, Encodable, Hashable, Sendable -
Undocumented
See moreDeclaration
Swift
public protocol ConcreteNodeID : NodeIDProtocol -
The ID of a pattern.
Declaration
Swift
public protocol PatternID : NodeIDProtocol -
The ID of a node outlining a lexical scope.
Declaration
Swift
public protocol ScopeID : NodeIDProtocol -
The ID of a statement.
Declaration
Swift
public protocol StmtID : NodeIDProtocol -
A pattern.
Declaration
Swift
public protocol Pattern : Node -
A statement.
Declaration
Swift
public protocol Stmt : Node -
A type whose instances can be updated without loss of information.
See moreDeclaration
Swift
protocol Monotonic : Equatable, Sendable -
Types representing Hylo programs at some stage after syntactic and scope analysis.
See moreDeclaration
Swift
public protocol Program : Sendable -
A box wrapping a term.
See moreDeclaration
Swift
private protocol TermBox : Sendable -
A protocol describing the API of a Hylo term.
See moreDeclaration
Swift
public protocol TermProtocol : Hashable, Sendable -
A constraint used to perform type checking or inference.
A constraint is a predicate over one or multiple types, including type variables, that must be satisfied in order for a program to be well-typed. Constraints also server to infer implicit type information from the structure of the program.
See moreDeclaration
Swift
protocol Constraint : Sendable -
A set of predicates that is satisfied if at least one of them is satisfied.
See moreDeclaration
Swift
protocol DisjunctiveConstraintProtocol : Constraint -
A predicate in a disjunctive constraint.
See moreDeclaration
Swift
protocol DisjunctiveConstraintTerm -
A term in a rewriting system.
See moreDeclaration
Swift
protocol RewritingTerm : Collection, Equatable, Sendable where Self.Element : Hashable, Self.Element : Sendable, Self.Index == Int, Self.SubSequence : Sendable -
A box wrapping a type.
See moreDeclaration
Swift
private protocol TypeBox : Sendable -
A type whose instances are callable entities.
See moreDeclaration
Swift
public protocol CallableType -
A protocol describing the API of a Hylo type.
See moreDeclaration
Swift
public protocol TypeProtocol : Hashable, Sendable
View on GitHub
Protocols Reference