Files
CSM14204-Compilers/src/compiler/types.py
T
2026-06-24 17:24:04 +02:00

30 lines
411 B
Python

from __future__ import annotations
from dataclasses import dataclass
class Int:
pass
class Bool:
pass
class Unit:
pass
Int_Instance = Int()
Bool_Instance = Bool()
Unit_Instance = Unit()
class Any(Int, Bool, Unit):
pass
Any_Instance = Any()
type Type = Int | Bool | Unit | FunType
ParamsType = Type | list[Type | list['ParamsType']]
@dataclass
class FunType:
params: ParamsType
result: Type