aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorCody <cody@codyq.dev>2023-01-29 20:58:04 -0600
committerCody <cody@codyq.dev>2023-01-29 20:58:04 -0600
commita653a6602fe5ae5eb4739755db7b34bc92ecdadf (patch)
tree2d99c570ccd77767e1d5fcf9b098d45c79cbe6e4 /src/main.rs
parentb856e5c7226e71e500be5eff7079c5d3b0e9e2f4 (diff)
downloadsloth-a653a6602fe5ae5eb4739755db7b34bc92ecdadf.tar.gz
More stuffs
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}");
}