From 31c197e991ad59fadb7a5823cebdefea5d4dc1d5 Mon Sep 17 00:00:00 2001 From: shadow cat Date: Tue, 26 Nov 2024 22:42:39 -0500 Subject: [PATCH] who knows --- data/test.lang | 10 ++++++++++ src/compiler/instruction.rs | 2 ++ src/compiler/mod.rs | 1 + src/ir/{structure => lvl1}/def.rs | 0 src/ir/{structure => lvl1}/func.rs | 0 src/ir/{structure => lvl1}/mod.rs | 0 src/ir/{structure => lvl1}/ty.rs | 0 src/ir/lvl2/mod.rs | 0 src/ir/mod.rs | 5 +++-- src/parser/v3/nodes/statement.rs | 2 +- 10 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 src/compiler/instruction.rs rename src/ir/{structure => lvl1}/def.rs (100%) rename src/ir/{structure => lvl1}/func.rs (100%) rename src/ir/{structure => lvl1}/mod.rs (100%) rename src/ir/{structure => lvl1}/ty.rs (100%) create mode 100644 src/ir/lvl2/mod.rs diff --git a/data/test.lang b/data/test.lang index 86a1d26..265bc34 100644 --- a/data/test.lang +++ b/data/test.lang @@ -1,3 +1,13 @@ +trait Add { + fn add(self, other: Self) -> Self +} + +impl Add for b32 { + asm fn add(self, other) { + add {out}, {self}, {other} + } +} + fn main() { asm { li a0, 3 diff --git a/src/compiler/instruction.rs b/src/compiler/instruction.rs new file mode 100644 index 0000000..92ef7e7 --- /dev/null +++ b/src/compiler/instruction.rs @@ -0,0 +1,2 @@ +pub enum Instruction { +} diff --git a/src/compiler/mod.rs b/src/compiler/mod.rs index 9431cdd..7e6459d 100644 --- a/src/compiler/mod.rs +++ b/src/compiler/mod.rs @@ -9,6 +9,7 @@ mod elf; mod program; pub mod riscv64; mod target; +mod instruction; pub use program::*; diff --git a/src/ir/structure/def.rs b/src/ir/lvl1/def.rs similarity index 100% rename from src/ir/structure/def.rs rename to src/ir/lvl1/def.rs diff --git a/src/ir/structure/func.rs b/src/ir/lvl1/func.rs similarity index 100% rename from src/ir/structure/func.rs rename to src/ir/lvl1/func.rs diff --git a/src/ir/structure/mod.rs b/src/ir/lvl1/mod.rs similarity index 100% rename from src/ir/structure/mod.rs rename to src/ir/lvl1/mod.rs diff --git a/src/ir/structure/ty.rs b/src/ir/lvl1/ty.rs similarity index 100% rename from src/ir/structure/ty.rs rename to src/ir/lvl1/ty.rs diff --git a/src/ir/lvl2/mod.rs b/src/ir/lvl2/mod.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/ir/mod.rs b/src/ir/mod.rs index f800255..0d9a88c 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -1,8 +1,9 @@ mod namespace; -mod structure; +mod lvl1; +mod lvl2; mod file; pub use namespace::*; -pub use structure::*; +pub use lvl1::*; pub use file::*; diff --git a/src/parser/v3/nodes/statement.rs b/src/parser/v3/nodes/statement.rs index 06dc9ce..41af52f 100644 --- a/src/parser/v3/nodes/statement.rs +++ b/src/parser/v3/nodes/statement.rs @@ -33,7 +33,7 @@ impl Debug for Statement { match self { Statement::Let(n, e) => { f.write_str("let ")?; - n.fmt(f); + n.fmt(f)?; f.write_str(" = ")?; e.fmt(f)?; f.write_char(';')?;