From c2c923276f7ecde1f71e53309dc5d1cc53cd3ff2 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 29 Sep 2024 19:50:55 +0200 Subject: Implement addition and subtraction --- lib/Language/Elna/AST.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/Language/Elna/AST.hs') diff --git a/lib/Language/Elna/AST.hs b/lib/Language/Elna/AST.hs index 087c2fd..4861318 100644 --- a/lib/Language/Elna/AST.hs +++ b/lib/Language/Elna/AST.hs @@ -115,12 +115,12 @@ instance Show VariableDeclaration show (VariableDeclaration identifier typeExpression) = concat ["var ", show identifier, ": " <> show typeExpression, ";"] -newtype Expression +data Expression = LiteralExpression Literal -{- | VariableExpression VariableAccess - | NegationExpression Expression | SumExpression Expression Expression | SubtractionExpression Expression Expression +{- | VariableExpression VariableAccess + | NegationExpression Expression | ProductExpression Expression Expression | DivisionExpression Expression Expression -} deriving Eq @@ -128,10 +128,10 @@ newtype Expression instance Show Expression where show (LiteralExpression literal) = show literal - {- show (VariableExpression variable) = show variable - show (NegationExpression negation) = '-' : show negation show (SumExpression lhs rhs) = concat [show lhs, " + ", show rhs] show (SubtractionExpression lhs rhs) = concat [show lhs, " - ", show rhs] + {- show (VariableExpression variable) = show variable + show (NegationExpression negation) = '-' : show negation show (ProductExpression lhs rhs) = concat [show lhs, " * ", show rhs] show (DivisionExpression lhs rhs) = concat [show lhs, " / ", show rhs] -} {- -- cgit v1.2.3