diff --git a/example.jl b/example.jl index ada6c55..4599e01 100644 --- a/example.jl +++ b/example.jl @@ -1,7 +1,3 @@ -defop 2 Left (a ++ b) - (a - b) - - def foo# 3 deftype Foo (A -> B) @@ -40,9 +36,9 @@ def empty [] def getFile (readFile "./parse.js") -def fileLines - (getFile >>= - ((mapM_ putStrLn) . lines)) +;;def fileLines +;; (getFile >>= +;; ((mapM_ putStrLn) . lines)) def (testUnary n) ((-n) + n) @@ -94,3 +90,5 @@ def main (unary + fileLines + (print splitted)) + +def blah (3 / 4) diff --git a/prelude.jl b/prelude.jl index 1826fe1..3fa12cc 100644 --- a/prelude.jl +++ b/prelude.jl @@ -69,3 +69,45 @@ defop 4 Left (a * b) defop 4 Left (a / b) (div a b) + +defop 5 Right (a ^ b) + (pow a b) + +defop 3 Left (a ++ b) + (listConcat a b) + +defop 2 Left (a == b) + (eq a b) + +defop 2 Left (a > b) + (gt a b) + +defop 2 Left (a >= b) + (gte a b) + +defop 2 Left (a < b) + (lt a b) + +defop 2 Left (a <= b) + (lte a b) + +defop 2 Left (a && b) + (and a b) + +defop 2 Left (a || b) + (or a b) + +defop 1 Left (x : xs) + (cons x xs) + +defop 1 Left (f $ x) + (fapply f x) + +defop 1 Left (f . g) + (compose f g) + +defop 1 Left (a | b) + (bitwiseOr a b) + +defop 1 Left (a & b) + (bitwiseAnd a b) diff --git a/representation.js b/representation.js index c669882..0a80723 100644 --- a/representation.js +++ b/representation.js @@ -374,8 +374,8 @@ OPInfo = { /*"+" : [3, "Left"], "-" : [3, "Left"], "*" : [4, "Left"], - "/" : [4, "Left"],*/ - "^" : [5, "Right"], + "/" : [4, "Left"], + "^" : [5, "Right"] "++" : [3, "Left"], "==" : [2, "Left"], ">" : [2, "Left"], @@ -383,17 +383,13 @@ OPInfo = { "<" : [2, "Left"], "<=" : [2, "Left"], "&&" : [2, "Left"], - "||" : [2, "Left"], + "||" : [2, "Left"],*/ "::" : [2, "Left"], - ":" : [1, "Left"], + /*":" : [1, "Left"], "$" : [1, "Left"], - ">>" : [1, "Left"], - ">>=" : [1, "Left"], - "<$>" : [1, "Left"], - "." : [1, "Left"], + "." : [1, "Left"],*/ "," : [1, "Left"], - "->" : [1, "Right"], - "|" : [1, "Left"]}; + "->" : [1, "Right"]}; module.exports = {