diff options
| author | Cody <cody@codyq.dev> | 2023-05-24 00:18:31 -0500 |
|---|---|---|
| committer | Cody <cody@codyq.dev> | 2023-05-24 00:18:31 -0500 |
| commit | e92ee3d43d9101e34ab6727441dc9567b8f80d72 (patch) | |
| tree | ac533733d300df711fa31c1d6b55e1d44383bedc | |
| parent | 99a08356c50190f783213ac99fc288712122f60f (diff) | |
| download | sloth-e92ee3d43d9101e34ab6727441dc9567b8f80d72.tar.gz | |
Some changes
| -rw-r--r-- | Cargo.lock | 9 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/sloth/Cargo.toml | 1 | ||||
| -rw-r--r-- | crates/sloth/src/main.rs | 2 | ||||
| -rw-r--r-- | crates/sloth/src/parser/ast.rs | 5 | ||||
| -rw-r--r-- | crates/sloth/src/parser/expr.rs | 2 | ||||
| -rw-r--r-- | crates/sloth_asm/Cargo.toml | 8 | ||||
| -rw-r--r-- | crates/sloth_asm/src/lib.rs | 1 | ||||
| -rw-r--r-- | flake.nix | 1 |
9 files changed, 26 insertions, 4 deletions
@@ -42,9 +42,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.141" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "once_cell" @@ -111,10 +111,15 @@ name = "sloth" version = "0.1.0" dependencies = [ "itertools", + "libc", "thiserror", ] [[package]] +name = "sloth_asm" +version = "0.1.0" + +[[package]] name = "sloth_bytecode" version = "0.1.0" dependencies = [ @@ -1,6 +1,7 @@ [workspace] members = [ "crates/sloth", + "crates/sloth_asm", "crates/sloth_bytecode", "crates/sloth_vm", ] 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 @@ + @@ -53,6 +53,7 @@ targets = [ "wasm32-unknown-unknown" ]; }) + cargo-watch cargo-deny cargo-release ]; |
