diff --git a/src/main.rs b/src/main.rs index 51ad7cc..66129a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,14 +7,8 @@ mod scanner; mod token; mod token_type; mod expr; -mod astprinter; use crate::rlox_interpreter::RLoxInterpreter; -use crate::token::Token; -use crate::token_type::TokenType; -use crate::expr::{Binary, Expr, Grouping, Literal, Unary, VisitableExpr}; -use crate::expr::Expr::LiteralExpr; -use crate::astprinter::ASTPrinter; // Exit codes from #include const EX_OK: i32 = 0; @@ -24,8 +18,6 @@ const EX_USAGE : i32 = 66; fn main() { let args: Vec = env::args().collect(); - essai_visitor(); - let exit_code = match args.len() { 1 => { RLoxInterpreter::new().run_prompt() } , 2 => { RLoxInterpreter::new().run_file(&args[1]) }, @@ -38,33 +30,6 @@ fn main() { process::exit(exit_code); } -fn essai_visitor() { - let expression = Expr::BinaryExpr(Binary { - left: Box::new(Expr::UnaryExpr( Unary { - operator: Token { - token_type: TokenType::Minus, - lexeme: String::from("-"), - line: 0, - literal: String::from("-") - }, - right: Box::new(Expr::LiteralExpr(Literal::LiteralNumber(456.0))) - })), - operator: Token { - token_type: TokenType::Star, - lexeme: String::from("*"), - line: 0, - literal: String::from("*") - }, - right: Box::new(Expr::GroupingExpr ( Grouping { - expression: Box::new(LiteralExpr(Literal::LiteralNumber(123.0))) - })) - }); - - let a = ASTPrinter{}; - expression.accept(&a); -} - - // Implémentations de référence : // https://github.com/munificent/craftinginterpreters/wiki/Lox-implementations#rust