From 136e3687b079d6374e97cdaea92f042be4e9b4f1 Mon Sep 17 00:00:00 2001 From: crumbtoo Date: Mon, 18 Dec 2023 15:36:17 -0700 Subject: [PATCH] Literal -> Lit, LitE -> Lit --- src/Core/Parse.y | 2 +- src/Core/Syntax.hs | 8 ++++---- src/Core/Utils.hs | 2 +- src/Core2Core.hs | 4 ++-- src/GM.hs | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Core/Parse.y b/src/Core/Parse.y index 94d0dcc..4dab15a 100644 --- a/src/Core/Parse.y +++ b/src/Core/Parse.y @@ -123,7 +123,7 @@ Alter :: { Alter Name } Alter : litint ParList '->' Expr { Alter (AltData $1) $2 $4 } Expr1 :: { Expr Name } -Expr1 : litint { LitE $ IntL $1 } +Expr1 : litint { Lit $ IntL $1 } | Id { Var $1 } | PackCon { $1 } | ExprPragma { $1 } diff --git a/src/Core/Syntax.hs b/src/Core/Syntax.hs index 676cf3b..2fc88f0 100644 --- a/src/Core/Syntax.hs +++ b/src/Core/Syntax.hs @@ -7,7 +7,7 @@ Description : Core ASTs and the like module Core.Syntax ( Expr(..) , Type(..) - , Literal(..) + , Lit(..) , pattern (:$) , Binding(..) , AltCon(..) @@ -47,7 +47,7 @@ data Expr b = Var Name | Lam [b] (Expr b) | Let Rec [Binding b] (Expr b) | App (Expr b) (Expr b) - | LitE Literal + | Lit Lit | Type Type deriving (Show, Read, Lift) @@ -87,11 +87,11 @@ data Rec = Rec deriving (Show, Read, Eq, Lift) data AltCon = AltData Tag - | AltLiteral Literal + | AltLit Lit | Default deriving (Show, Read, Eq, Lift) -data Literal = IntL Int +data Lit = IntL Int deriving (Show, Read, Eq, Lift) type Name = String diff --git a/src/Core/Utils.hs b/src/Core/Utils.hs index dd9c6ed..892a7e3 100644 --- a/src/Core/Utils.hs +++ b/src/Core/Utils.hs @@ -32,7 +32,7 @@ rhssOf = fromList . fmap f isAtomic :: Expr b -> Bool isAtomic (Var _) = True -isAtomic (LitE _) = True +isAtomic (Lit _) = True isAtomic _ = False ---------------------------------------------------------------------------------- diff --git a/src/Core2Core.hs b/src/Core2Core.hs index ed885bc..7aa9dc6 100644 --- a/src/Core2Core.hs +++ b/src/Core2Core.hs @@ -55,7 +55,7 @@ floatNonStrictCases g = goE where goE :: Expr' -> Floater Expr' goE (Var k) = pure (Var k) - goE (LitE l) = pure (LitE l) + goE (Lit l) = pure (Lit l) goE (Case e as) = pure (Case e as) goE (Let Rec bs e) = Let Rec <$> bs' <*> goE e where bs' = travBs goE bs @@ -77,7 +77,7 @@ floatNonStrictCases g = goE goC (f :$ x) = (:$) <$> goC f <*> goC x goC (Let r bs e) = Let r <$> bs' <*> goE e where bs' = travBs goC bs - goC (LitE l) = pure (LitE l) + goC (Lit l) = pure (Lit l) goC (Var k) = pure (Var k) goC (Con t as) = pure (Con t as) diff --git a/src/GM.hs b/src/GM.hs index a29e158..00f125f 100644 --- a/src/GM.hs +++ b/src/GM.hs @@ -617,7 +617,7 @@ buildInitialHeap (Program ss) = mapAccumL allocateSc mempty compiledScs f (NameKey n, _) = Just n f _ = Nothing - compileC _ (LitE l) = compileCL l + compileC _ (Lit l) = compileCL l -- >> [ref/compileC] compileC g (App f x) = compileC g x @@ -661,16 +661,16 @@ buildInitialHeap (Program ss) = mapAccumL allocateSc mempty compiledScs compileC _ _ = error "yet to be implemented!" - compileCL :: Literal -> Code + compileCL :: Lit -> Code compileCL (IntL n) = [PushInt n] - compileEL :: Literal -> Code + compileEL :: Lit -> Code compileEL (IntL n) = [PushInt n] -- compile an expression in a strict context such that a pointer to the -- expression is left on top of the stack in WHNF compileE :: Env -> Expr' -> Code - compileE _ (LitE l) = compileEL l + compileE _ (Lit l) = compileEL l compileE g (Let NonRec bs e) = -- we use compileE instead of compileC mconcat binders <> compileE g' e <> [Slide d]