diff --git a/schala-lang/language/src/ast/operators.rs b/schala-lang/language/src/ast/operators.rs index b55d423..5e11830 100644 --- a/schala-lang/language/src/ast/operators.rs +++ b/schala-lang/language/src/ast/operators.rs @@ -80,8 +80,8 @@ fn binop_precedences(s: &str) -> i32 { "<" => 20, "<=" => 20, "==" => 40, - "=" => 10, "<=>" => 30, + "=" => 5, // Assignment shoudl have highest precedence _ => default, } } diff --git a/schala-lang/language/src/tree_walk_eval/test.rs b/schala-lang/language/src/tree_walk_eval/test.rs index d1bea6f..05ee593 100644 --- a/schala-lang/language/src/tree_walk_eval/test.rs +++ b/schala-lang/language/src/tree_walk_eval/test.rs @@ -8,6 +8,7 @@ fn evaluate_input(input: &str) -> Result { let mut symbol_table = SymbolTable::new(); symbol_table.process_ast(&ast).unwrap(); let reduced_ir = crate::reduced_ir::reduce(&ast, &symbol_table); + reduced_ir.debug(&symbol_table); let mut state = State::new(); let mut outputs = state.evaluate(reduced_ir, true); outputs.pop().unwrap() @@ -21,10 +22,7 @@ fn eval_assert(input: &str, expected: &str) { fn test_basic_eval() { eval_assert("1 + 2", "3"); eval_assert("let mut a = 1; a = 2", "()"); - /* - test_in_fresh_env!("let mut a = 1; a = 2; a", "2"); - test_in_fresh_env!(r#"("a", 1 + 2)"#, r#"("a", 3)"#); - */ + eval_assert("let mut a = 1; a = a + 2; a", "3"); } #[test]