Skip to content

Commit

Permalink
fix some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
NightProg committed Oct 7, 2023
1 parent 8ffd182 commit e473d7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ popper_error = { path = "crates/popper_error" }
popper_asm = { git = "https://github.com/popper-lang/popper-asm.git" }


[patch."https://github.com/popper-lang/popper-asm.git"]
popper_asm = { path = "../popper-asm" }






5 changes: 3 additions & 2 deletions crates/popper_builtin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::string::ToString;
use popper_ast::{Span, TypeKind};
use popper_asm::ast::{Register, Command, MemoryFetching, Mov, Add, Expr};
use popper_asm::ast::{Register, Command, MemoryFetching, Mov, Add, Expr, Ret};
use popper_flag::{SymbolFlags, ValueFlag};
use popper_error::{diff_length_of_argument::DiffLengthOfArgument, typemismatch::TypeMismatch, Error};

Expand Down Expand Up @@ -64,7 +64,8 @@ fn builtin_print() -> impl Builtin {
Mov(MemoryFetching::Addr(500), Expr::Memory(
MemoryFetching::Register(Register::R1)
))
)
),
Command::Ret(Ret)
],
preload_asm: None,
argument_type: vec![TypeKind::Int],
Expand Down
7 changes: 4 additions & 3 deletions crates/popper_sac/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ use popper_asm::ast::{
Add,
Sub,
Mul,
Div
Div,
Ret
};

use popper_builtin::builtins;
Expand Down Expand Up @@ -99,7 +100,8 @@ impl Compiler {
for stmt in self.program.clone() {
self.visit_stmt(stmt);
}
self.asm.labels.push(self.current_label.clone());
self.current_label.program.push(Command::Ret(Ret));
self.asm.labels.insert(0, self.current_label.clone());
}

}
Expand Down Expand Up @@ -197,7 +199,6 @@ impl ExprVisitor for Compiler {
Call(label.name.clone())
)
);

Ok(())

}
Expand Down

0 comments on commit e473d7a

Please sign in to comment.