diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index cfeb08e..7bbe6b4 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -691,8 +691,7 @@ infer_infix({BoolOp, As}) {fun_t, As, [], [Bool,Bool], Bool}; infer_infix({IntOp, As}) when IntOp == '+'; IntOp == '-'; IntOp == '*'; IntOp == '/'; - IntOp == '^'; IntOp == 'mod'; IntOp == 'bsl'; IntOp == 'bsr'; - IntOp == 'band'; IntOp == 'bor'; IntOp == 'bxor' -> + IntOp == '^'; IntOp == 'mod' -> Int = {id, As, "int"}, {fun_t, As, [], [Int, Int], Int}; infer_infix({RelOp, As}) @@ -714,8 +713,7 @@ infer_infix({'++', As}) -> infer_prefix({'!',As}) -> Bool = {id, As, "bool"}, {fun_t, As, [], [Bool], Bool}; -infer_prefix({IntOp,As}) - when IntOp =:= '-'; IntOp =:= 'bnot' -> +infer_prefix({IntOp,As}) when IntOp =:= '-' -> Int = {id, As, "int"}, {fun_t, As, [], [Int], Int}. diff --git a/src/aeso_ast_to_icode.erl b/src/aeso_ast_to_icode.erl index 0509847..9f90550 100644 --- a/src/aeso_ast_to_icode.erl +++ b/src/aeso_ast_to_icode.erl @@ -526,9 +526,6 @@ ast_binop(Op, Ann, {typed, _, A, Type}, B, Icode) ast_binop('++', _, A, B, Icode) -> #funcall{ function = #var_ref{ name = {builtin, list_concat} }, args = [ast_body(A, Icode), ast_body(B, Icode)] }; -%% Bit shift operations takes their arguments backwards!? -ast_binop(Op, _, A, B, Icode) when Op =:= 'bsl'; Op =:= 'bsr' -> - #binop{op = Op, right = ast_body(A, Icode), left = ast_body(B, Icode)}; ast_binop(Op, _, A, B, Icode) -> #binop{op = Op, left = ast_body(A, Icode), right = ast_body(B, Icode)}. diff --git a/src/aeso_parser.erl b/src/aeso_parser.erl index f84295e..57c61cf 100644 --- a/src/aeso_parser.erl +++ b/src/aeso_parser.erl @@ -176,11 +176,11 @@ expr200() -> infixr(expr300(), binop('||')). expr300() -> infixr(expr400(), binop('&&')). expr400() -> infix(expr500(), binop(['<', '>', '=<', '>=', '==', '!='])). expr500() -> infixr(expr600(), binop(['::', '++'])). -expr600() -> infixl(expr650(), binop(['+', '-', 'bor', 'bxor', 'bsr', 'bsl'])). +expr600() -> infixl(expr650(), binop(['+', '-'])). expr650() -> ?RULE(many(token('-')), expr700(), prefixes(_1, _2)). -expr700() -> infixl(expr750(), binop(['*', '/', mod, 'band'])). +expr700() -> infixl(expr750(), binop(['*', '/', mod])). expr750() -> infixl(expr800(), binop(['^'])). -expr800() -> ?RULE(many(choice(token('!'), token('bnot'))), expr900(), prefixes(_1, _2)). +expr800() -> ?RULE(many(token('!')), expr900(), prefixes(_1, _2)). expr900() -> ?RULE(exprAtom(), many(elim()), elim(_1, _2)). exprAtom() -> diff --git a/src/aeso_pretty.erl b/src/aeso_pretty.erl index 3462a2e..f9209dd 100644 --- a/src/aeso_pretty.erl +++ b/src/aeso_pretty.erl @@ -359,20 +359,14 @@ bin_prec('++') -> {500, 600, 500}; bin_prec('::') -> {500, 600, 500}; bin_prec('+') -> {600, 600, 650}; bin_prec('-') -> {600, 600, 650}; -bin_prec('bor') -> {600, 600, 650}; -bin_prec('bxor') -> {600, 600, 650}; -bin_prec('bsl') -> {600, 600, 650}; -bin_prec('bsr') -> {600, 600, 650}; bin_prec('*') -> {700, 700, 750}; bin_prec('/') -> {700, 700, 750}; bin_prec(mod) -> {700, 700, 750}; -bin_prec('band') -> {700, 700, 750}; bin_prec('^') -> {750, 750, 800}. -spec un_prec(aeso_syntax:un_op()) -> {integer(), integer()}. un_prec('-') -> {650, 650}; -un_prec('!') -> {800, 800}; -un_prec('bnot') -> {800, 800}. +un_prec('!') -> {800, 800}. equals(Ann, A, B) -> {app, [{format, infix} | Ann], {'=', Ann}, [A, B]}. diff --git a/src/aeso_scan.erl b/src/aeso_scan.erl index 5cee063..17f4153 100644 --- a/src/aeso_scan.erl +++ b/src/aeso_scan.erl @@ -37,8 +37,7 @@ lexer() -> , {"[^/*]+|[/*]", skip()} ], Keywords = ["contract", "import", "let", "rec", "switch", "type", "record", "datatype", "if", "elif", "else", "function", - "stateful", "true", "false", "and", "mod", "public", "private", "indexed", "internal", - "band", "bor", "bxor", "bsl", "bsr", "bnot"], + "stateful", "true", "false", "and", "mod", "public", "private", "indexed", "internal"], KW = string:join(Keywords, "|"), Rules = diff --git a/src/aeso_syntax.erl b/src/aeso_syntax.erl index 5767e82..f8dc364 100644 --- a/src/aeso_syntax.erl +++ b/src/aeso_syntax.erl @@ -75,10 +75,10 @@ -type op() :: bin_op() | un_op(). --type bin_op() :: '+' | '-' | '*' | '/' | mod | '^' | 'band' | 'bor' | 'bsl' | 'bsr' | 'bxor' +-type bin_op() :: '+' | '-' | '*' | '/' | mod | '^' | '++' | '::' | '<' | '>' | '=<' | '>=' | '==' | '!=' | '||' | '&&' | '..'. --type un_op() :: '-' | '!' | 'bnot'. +-type un_op() :: '-' | '!'. -type expr() :: {lam, ann(), [arg()], expr()} diff --git a/test/contracts/all_syntax.aes b/test/contracts/all_syntax.aes index b3ac623..4b80311 100644 --- a/test/contracts/all_syntax.aes +++ b/test/contracts/all_syntax.aes @@ -36,8 +36,6 @@ contract AllSyntax = (x, [y, z]) => bar({x = z, y = -y + - -z * (-1)}) (x, y :: _) => () - function bitOperations(x, y) = bnot (0xff00 band x bsl 4 bxor 0xa5a5a5 bsr 4 bor y) - function mutual() = let rec recFun(x : int) = mutFun(x) and mutFun(x) = if(x =< 0) 1 else x * recFun(x - 1) diff --git a/test/contracts/operators.aes b/test/contracts/operators.aes index 9ac89fb..1363a6c 100644 --- a/test/contracts/operators.aes +++ b/test/contracts/operators.aes @@ -1,5 +1,4 @@ // - + * / mod arithmetic operators -// bnot band bor bxor bsl bsr bitwise operators // ! && || logical operators // == != < > =< >= comparison operators // :: ++ list operators @@ -13,12 +12,6 @@ contract Operators = "/" => a / b "mod" => a mod b "^" => a ^ b - "bnot" => bnot a - "band" => a band b - "bor" => a bor b - "bxor" => a bxor b - "bsl" => a bsl b - "bsr" => a bsr b function bool_op(a : bool, b : bool, op : string) = switch(op)