recursive types (and operations on them, like pretty-printing, comparison and unification) seem to be working.

big part of the code base still needs to be 'ported' to the updated type constructors.
This commit is contained in:
Joeri Exelmans 2025-05-05 17:17:45 +02:00
parent 55c5d7cffa
commit 8eec5b9239
34 changed files with 523 additions and 295 deletions

View file

@ -2,16 +2,16 @@
import { makeTypeConstructor } from "../type_constructor.js";
export const SymbolInt = Symbol('Int');
export const SymbolBool = Symbol('Bool');
export const SymbolDouble = Symbol('Double');
export const SymbolByte = Symbol('Byte');
export const SymbolChar = Symbol('Char');
export const SymbolUnit = Symbol('Unit');
export const SymbolBottom = Symbol('⊥');
export const SymbolSymbol = Symbol('Symbol');
export const SymbolType = Symbol('Type');
export const symbolAny = Symbol('Any');
export const SymbolInt = Symbol('Int');
export const SymbolBool = Symbol('Bool');
export const SymbolDouble = Symbol('Double');
export const SymbolByte = Symbol('Byte');
export const SymbolChar = Symbol('Char');
export const SymbolUnit = Symbol('Unit');
export const SymbolBottom = Symbol('⊥');
export const SymbolSymbol = Symbol('Symbol');
export const SymbolType = Symbol('Type');
export const symbolTop = Symbol('');
export const SymbolGenericType = Symbol('GenericType');
export const Int = makeTypeConstructor(SymbolInt)(0);
@ -28,23 +28,24 @@ export const Bottom = makeTypeConstructor(SymbolBottom)(0);
export const SymbolT = makeTypeConstructor(SymbolSymbol)(0);
// Types are typed by Any
// Types are typed by Top
export const Type = makeTypeConstructor(SymbolType)(0);
export const GenericType = makeTypeConstructor(SymbolGenericType)(0);
// Everything is typed by Any
export const Any = makeTypeConstructor(symbolAny)(0);
// Everything is typed by Top
export const Top = makeTypeConstructor(symbolTop)(0);
export const ModuleSymbols = {l:[
{i: SymbolInt , t: SymbolT},
{i: SymbolBool , t: SymbolT},
{i: SymbolDouble, t: SymbolT},
{i: SymbolByte , t: SymbolT},
{i: SymbolChar , t: SymbolT},
{i: SymbolUnit , t: SymbolT},
{i: SymbolBottom, t: SymbolT},
{i: SymbolSymbol, t: SymbolT},
{i: SymbolType , t: SymbolT},
{i: SymbolInt , t: SymbolT},
{i: SymbolBool , t: SymbolT},
{i: SymbolDouble , t: SymbolT},
{i: SymbolByte , t: SymbolT},
{i: SymbolChar , t: SymbolT},
{i: SymbolUnit , t: SymbolT},
{i: SymbolBottom , t: SymbolT},
{i: SymbolSymbol , t: SymbolT},
{i: SymbolType , t: SymbolT},
{i: SymbolGenericType, t: SymbolT},
{i: symbolTop , t: SymbolT},
]};