X-Git-Url: https://git.lukelau.me/?p=kaleidoscope-hs.git;a=blobdiff_plain;f=AST.hs;h=7dad3a19e91eab9f12657101bd224b5c81742d07;hp=b57d7cb8cede024a9c2bb0e366d8d066474d331d;hb=HEAD;hpb=0daa38ae816488b94b57154c11a7bff5d376a28d diff --git a/AST.hs b/AST.hs index b57d7cb..9ff555a 100644 --- a/AST.hs +++ b/AST.hs @@ -4,7 +4,7 @@ import Data.Char import Text.Read import Text.ParserCombinators.ReadP hiding ((+++), choice) -data Expr = Num Float +data Expr = Num Double | Var String | BinOp BinOp Expr Expr | Call String [Expr] @@ -18,6 +18,8 @@ instance Read Expr where , parseVar , parseCall , parseBinOp "<" 10 (Cmp LT) + , parseBinOp ">" 10 (Cmp GT) + , parseBinOp "==" 10 (Cmp EQ) , parseBinOp "+" 20 Add , parseBinOp "-" 20 Sub , parseBinOp "*" 40 Mul