This repository has been archived on 2024-04-05. You can view files and clone it, but cannot push or open issues/pull-requests.
really-bad-compiler-in-haskell/app/Eval/Expression.hs

13 lines
281 B
Haskell

module Eval.Expression (evalExpr) where
import Objects.Expression
eval :: Expr -> Int
eval (Lit x) = x
eval (Add x y) = eval x + eval y
eval (Sub x y) = eval x - eval y
eval (Mul x y) = eval x * eval y
eval (Div x y) = eval x `div` eval y
evalExpr :: Expr -> Int
evalExpr = eval