From 8a4f44b8d5a0fd23cd332d8989c5398e134b1a59 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 31 Oct 2024 16:17:45 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit semver: chore --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0f3c371..a6d139d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,14 @@ fn main() { })) .unwrap(); - let input = "true if true else 12 if true else 'h'; + let input = " fn main() { + fib(9999); + } + + fn fib(n ~ int) ~ int { + if n < 2 return n; + fib(n - 1) + fib(n - 20) + } "; let mut parser = Parser::new(input); @@ -67,8 +74,9 @@ fn print_statement(statement: Statement) { print_statement(statement); } } + Statement::Return(expression) => print_expression(expression), Statement::Expression(expression) => print_expression(expression), - _ => println!("{:?}", statement), + _ => {} } }