From 5af9509a5fe9f2255c2e6e61f0c3ca753a279658 Mon Sep 17 00:00:00 2001 From: sebastianselander Date: Mon, 8 May 2023 11:23:06 +0200 Subject: [PATCH] Fixed prelude and codegen --- src/Codegen/Emits.hs | 3 +-- src/Main.hs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Codegen/Emits.hs b/src/Codegen/Emits.hs index 3a26ff8..fb9ed35 100644 --- a/src/Codegen/Emits.hs +++ b/src/Codegen/Emits.hs @@ -367,9 +367,8 @@ emitApp rt e1 e2 = do Global <$ Map.lookup name consts <|> Global <$ Map.lookup (name, t) funcs -- this piece of code could probably be improved, i.e remove the double `const Global` - call <- case name of - Ident ('l' : 't' : '$' : _) -> + Ident ('$' : 'l' : 'a' : 'n' : 'g' : 'l' : 'e' : '$' : _) -> pure $ Icmp LLSlt I64 (snd (head args)) (snd (args !! 1)) Ident ('$' : 'm' : 'i' : 'n' : 'u' : 's' : '$' : '$' : _) -> pure $ Sub I64 (snd (head args)) (snd (args !! 1)) diff --git a/src/Main.hs b/src/Main.hs index 22aa560..4dcf1a5 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -175,8 +175,8 @@ prelude = , " False : Bool" , " True : Bool" , -- The function body of lt is replaced during code gen. It exists here for type checking purposes. - "lt : Int -> Int -> Bool" - , "lt x y = case x of" + ".< : Int -> Int -> Bool" + , ".< x y = case x of" , " _ => True" , " _ => False" , "\n"