aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/sloth/Cargo.toml1
-rw-r--r--crates/sloth/src/main.rs2
-rw-r--r--crates/sloth/src/parser/ast.rs5
-rw-r--r--crates/sloth/src/parser/expr.rs2
-rw-r--r--crates/sloth_asm/Cargo.toml8
-rw-r--r--crates/sloth_asm/src/lib.rs1
6 files changed, 17 insertions, 2 deletions
diff --git a/crates/sloth/Cargo.toml b/crates/sloth/Cargo.toml
index 2ee6919..1b7a9fc 100644
--- a/crates/sloth/Cargo.toml
+++ b/crates/sloth/Cargo.toml
@@ -7,4 +7,5 @@ edition.workspace = true
[dependencies]
itertools = "0.10.5"
+libc = "0.2.142"
thiserror = "1.0.40"
diff --git a/crates/sloth/src/main.rs b/crates/sloth/src/main.rs
index 0eb4c24..8fab058 100644
--- a/crates/sloth/src/main.rs
+++ b/crates/sloth/src/main.rs
@@ -38,5 +38,5 @@ fn main() {
// println!("{:#?}", parser);
let parsed = &parser.parse();
- println!("{:#?}", parsed);
+ println!("{parsed:#?}");
}
diff --git a/crates/sloth/src/parser/ast.rs b/crates/sloth/src/parser/ast.rs
index 3c8cdeb..12dad13 100644
--- a/crates/sloth/src/parser/ast.rs
+++ b/crates/sloth/src/parser/ast.rs
@@ -24,6 +24,7 @@ pub enum BinaryOp {
LogOr,
Range,
}
+
#[derive(Debug, PartialEq)]
pub enum UnaryOp {
Not,
@@ -31,6 +32,7 @@ pub enum UnaryOp {
BWComp,
}
+
#[derive(Debug, PartialEq)]
pub enum Literal {
Integer(i128),
@@ -41,6 +43,7 @@ pub enum Literal {
Regex(String),
List(Vec<Expr>),
}
+
#[derive(Debug, PartialEq)]
pub enum Expr {
Grouping(Box<Expr>),
@@ -61,11 +64,13 @@ pub enum Expr {
Literal(Literal),
Lambda, // TODO: Lambda
}
+
#[derive(PartialEq, Debug)]
pub struct FuncArgs {
pub name: String,
pub typ: Option<String>,
}
+
#[derive(PartialEq, Debug)]
pub enum Stmt {
ExprStmt(Expr),
diff --git a/crates/sloth/src/parser/expr.rs b/crates/sloth/src/parser/expr.rs
index ad35d20..8036552 100644
--- a/crates/sloth/src/parser/expr.rs
+++ b/crates/sloth/src/parser/expr.rs
@@ -156,7 +156,7 @@ impl<'a> AstParser<'a> {
// Binary expressions in order of precedence from lowest to highest.
binary_expr!(logical_or , logical_and , (TokenType::PipePipe));
binary_expr!(logical_and , range , (TokenType::AmpAmp));
- binary_expr!(range , equality , (TokenType::DotDot));
+ binary_expr!(range , equality , (TokenType::DotDot));
binary_expr!(equality , comparison , (TokenType::BangEq | TokenType::EqEq));
binary_expr!(comparison , bitwise_shifting, (TokenType::Lt | TokenType::Gt | TokenType::LtEq | TokenType::GtEq));
binary_expr!(bitwise_shifting, additive , (TokenType::LtLt | TokenType::GtGt));
diff --git a/crates/sloth_asm/Cargo.toml b/crates/sloth_asm/Cargo.toml
new file mode 100644
index 0000000..b3ae934
--- /dev/null
+++ b/crates/sloth_asm/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "sloth_asm"
+
+license.workspace = true
+version.workspace = true
+edition.workspace = true
+
+[dependencies]
diff --git a/crates/sloth_asm/src/lib.rs b/crates/sloth_asm/src/lib.rs
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/crates/sloth_asm/src/lib.rs
@@ -0,0 +1 @@
+