From a653a6602fe5ae5eb4739755db7b34bc92ecdadf Mon Sep 17 00:00:00 2001 From: Cody Date: Sun, 29 Jan 2023 20:58:04 -0600 Subject: More stuffs --- src/main.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 8f3c001..f064d39 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,13 +10,16 @@ pub mod ast; pub mod lexer; +use ast::{Expression, Operation, Value}; use lexer::Lexer; +use crate::ast::Statement; + const SOURCE: &str = r#" val variable = 5; -if variable >= 7 { +if variable <= 7 { print "Hello World"; } @@ -27,4 +30,17 @@ fn main() { for token in lexer { print!("{} ", token.lexeme); } + + println!("-------"); + + let a = Expression::Literal(Value(7)); + let b = Expression::Binary { + operation: Operation::Add, + lhs: &Expression::Literal(Value(5)), + rhs: &a, + }; + + let stmt = Statement::Expression { expr: &b }; + + println!("{stmt}"); } -- cgit v1.2.3