diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-21 16:48:30 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-21 16:48:30 +0200 |
| commit | 93562669065a42f1eb0c81f1a506013d6b03bce5 (patch) | |
| tree | d9f1c89ba3ed267798722cf89bb346fdc4600c83 /src/main.rs | |
| parent | 9e11e7e585b0bbcf428d56f7e159913010fa0756 (diff) | |
Cleanup
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/src/main.rs b/src/main.rs index 767c39c..4e5a609 100644 --- a/src/main.rs +++ b/src/main.rs @@ -186,10 +186,6 @@ mod runtime { } fn try_apply_function(func_rc: Rc<Value>, arg: Rc<Value>, bound_v: Option<usize>) -> Rc<Value> { - // println!( - // "[runtime] evaluating\nfunc: {:#?}\narg:{:#?}\nbound_v: {:#?}", - // func_rc, arg, bound_v - // ); let func = &*func_rc; match func { @@ -213,8 +209,6 @@ mod runtime { } _ => func_rc, } - - // println!("[runtime] returning from eval: {:#?}\n", ret); } fn evaluate_expr_inner_unary( @@ -289,46 +283,6 @@ mod runtime { evaluate_expr_inner_binary(symbol_table, inner1, inner2) } } - - // println!("[runtime] evaluating expression"); - // let head = &expression[0]; - // let tail = &expression[1..]; - // let arity = tail.len(); - // match head { - // ast::ExpressionInner::IntegerLiteral(value) => match arity { - // 0 => Rc::new(Value::Integer(*value)), - // _ => panic!("[runtime] cannot apply integer: {}", value), - // }, - // ast::ExpressionInner::StringLiteral(value) => match arity { - // 0 => Rc::new(Value::String(value.clone())), - // _ => panic!("[runtime] cannot apply string: {}", value), - // }, - // ast::ExpressionInner::Symbol(value) => match arity { - // 0 => { - // let builtin_value = try_evaluate_builtin(value); - // if builtin_value.is_some() { - // return Rc::new(builtin_value.unwrap()); - // } - - // let table_lookup_value = symbol_table.get(value); - // if table_lookup_value.is_some() { - // let lookup_rc = table_lookup_value.unwrap(); - // return lookup_rc.clone(); - // } - - // Rc::new(Value::String(String::from("dummy value"))) - // } - // 1 => { - // // let arg = &tail[0]; - // // let applied = try_apply_function(value, arg, None); - // panic!("should apply function here!") - // } - // _ => unreachable!( - // "[runtime] expression arity >= 2! there must be an error in AST generation" - // ), - // }, - // ast::ExpressionInner::Expression(expression) => evaluate_expr(symbol_table, expression), - // } } pub fn evaluate(program: &ast::Program) { @@ -376,7 +330,7 @@ fn main() { // println!("parse tree = {:#?}", parse_tree); let syntax_tree: Program = ast::from_parse_tree(&mut parse_tree); - println!("syntax tree = {:#?}", syntax_tree); + // println!("syntax tree = {:#?}", syntax_tree); runtime::evaluate(&syntax_tree); } |
