diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-09-29 19:50:55 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-09-29 19:50:55 +0200 |
| commit | c2c923276f7ecde1f71e53309dc5d1cc53cd3ff2 (patch) | |
| tree | 88a3667a31d5c463014ff2691acbfb7afb6bc0b1 /lib/Language/Elna/AST.hs | |
| parent | ed144309fab03565e7b6963b5e5e936b658a053f (diff) | |
| download | elna-c2c923276f7ecde1f71e53309dc5d1cc53cd3ff2.tar.gz | |
Implement addition and subtraction
Diffstat (limited to 'lib/Language/Elna/AST.hs')
| -rw-r--r-- | lib/Language/Elna/AST.hs | 10 |
1 files changed, 5 insertions, 5 deletions
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] -} {- |
