aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs18
1 files changed, 17 insertions, 1 deletions
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}");
}