Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
tpl_constraints.H File Reference

Equality constraints and type unification helpers for compiler work. More...

#include <sstream>
#include <string>
#include <Compiler_Types.H>
#include <ah-errors.H>
#include <ah-source.H>
#include <tpl_dynArray.H>
Include dependency graph for tpl_constraints.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Aleph::Equality_Constraint< T >
 Equality constraint between two values of type T. More...
 
class  Aleph::Constraint_Set< T >
 Ordered collection of equality constraints. More...
 
struct  Aleph::Compiler_Unify_Result
 Outcome of one type-unification attempt. More...
 
class  Aleph::Compiler_Type_Substitution
 Mutable substitution from type variables to replacement types. More...
 
struct  Aleph::Compiler_Type_Substitution::Binding
 One variable binding inside the substitution. More...
 
class  Aleph::Compiler_Type_Unifier
 Structural unifier for compiler types. More...
 

Namespaces

namespace  Aleph
 Main namespace for Aleph-w library functions.
 

Typedefs

using Aleph::Compiler_Type_Constraint = Equality_Constraint< Compiler_Type_Id >
 
using Aleph::Compiler_Type_Constraint_Set = Constraint_Set< Compiler_Type_Id >
 

Enumerations

enum class  Aleph::Compiler_Unify_Result_Kind {
  Aleph::Success , Aleph::Invalid_Type , Aleph::Kind_Mismatch , Aleph::Arity_Mismatch ,
  Aleph::Occurs_Check_Failed , Aleph::Rigid_Variable
}
 Result category returned by type unification. More...
 

Functions

const char * Aleph::compiler_unify_result_kind_name (const Compiler_Unify_Result_Kind kind) noexcept
 Returns a stable debug name for one unification result kind.
 

Detailed Description

Equality constraints and type unification helpers for compiler work.

The generic half of this header is a small equality-constraint worklist. The compiler-oriented half builds on it with substitutions and a unifier for Compiler_Type_Id.

The current solver supports:

  • substitutions for type variables
  • rigid variables
  • structural unification of tuples and functions
  • occurs-check failures

It intentionally does not emit diagnostics by itself. Callers can map Compiler_Unify_Result back to source-level diagnostics when needed.

Definition in file tpl_constraints.H.