summaryrefslogtreecommitdiff
path: root/src/AST.hs
diff options
context:
space:
mode:
authorTom Smeding <t.j.smeding@uu.nl>2024-12-12 16:30:42 +0100
committerTom Smeding <t.j.smeding@uu.nl>2024-12-12 16:30:42 +0100
commitf323076ddf6fbea9f7a1a4dfeec98629459c49fc (patch)
treed19137df436ac388c79bffe55df4a1b9b29316a8 /src/AST.hs
parentfad10d5a218f935d47e8b9dc41256a30b4ec540d (diff)
Somewhat working Compile
Diffstat (limited to 'src/AST.hs')
-rw-r--r--src/AST.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/AST.hs b/src/AST.hs
index fff290a..333f306 100644
--- a/src/AST.hs
+++ b/src/AST.hs
@@ -175,6 +175,25 @@ data SOp a t where
OIDiv :: ScalIsIntegral a ~ True => SScalTy a -> SOp (TPair (TScal a) (TScal a)) (TScal a)
deriving instance Show (SOp a t)
+opt1 :: SOp a t -> STy a
+opt1 = \case
+ OAdd t -> STPair (STScal t) (STScal t)
+ OMul t -> STPair (STScal t) (STScal t)
+ ONeg t -> STScal t
+ OLt t -> STPair (STScal t) (STScal t)
+ OLe t -> STPair (STScal t) (STScal t)
+ OEq t -> STPair (STScal t) (STScal t)
+ ONot -> STScal STBool
+ OAnd -> STPair (STScal STBool) (STScal STBool)
+ OOr -> STPair (STScal STBool) (STScal STBool)
+ OIf -> STScal STBool
+ ORound64 -> STScal STF64
+ OToFl64 -> STScal STI64
+ ORecip t -> STScal t
+ OExp t -> STScal t
+ OLog t -> STScal t
+ OIDiv t -> STPair (STScal t) (STScal t)
+
opt2 :: SOp a t -> STy t
opt2 = \case
OAdd t -> STScal t