projects
/
kaleidoscope-hs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Find our JIT'ed function and run it
[kaleidoscope-hs.git]
/
AST.hs
diff --git
a/AST.hs
b/AST.hs
index b57d7cb8cede024a9c2bb0e366d8d066474d331d..9ff555a74d10c6d970fc8b7df0a37c1d98fdbffc 100644
(file)
--- a/
AST.hs
+++ b/
AST.hs
@@
-4,7
+4,7
@@
import Data.Char
import Text.Read
import Text.ParserCombinators.ReadP hiding ((+++), choice)
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]
| Var String
| BinOp BinOp Expr Expr
| Call String [Expr]
@@
-18,6
+18,8
@@
instance Read Expr where
, parseVar
, parseCall
, parseBinOp "<" 10 (Cmp LT)
, parseVar
, parseCall
, parseBinOp "<" 10 (Cmp LT)
+ , parseBinOp ">" 10 (Cmp GT)
+ , parseBinOp "==" 10 (Cmp EQ)
, parseBinOp "+" 20 Add
, parseBinOp "-" 20 Sub
, parseBinOp "*" 40 Mul
, parseBinOp "+" 20 Add
, parseBinOp "-" 20 Sub
, parseBinOp "*" 40 Mul