13 lines
281 B
Haskell
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 |