Skip to content

Commit

Permalink
fix: short hand dec
Browse files Browse the repository at this point in the history
  • Loading branch information
SpideyZac committed Jun 3, 2024
1 parent 9257812 commit 79322a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 0 additions & 4 deletions src/compiler/target/vm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,6 @@ void machine_copy(machine *vm) {
}

void machine_mov(machine *vm) {
for (int i = 0; i < vm->stack_pointer; i++) {
printf("%f ", vm->stack[i]);
}

int offset = machine_pop(vm);
float value = machine_pop(vm);

Expand Down
20 changes: 11 additions & 9 deletions src/compiler/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,16 +253,18 @@ impl<'a> Visitor<'a> {
.clone();

if self.program_state.is_inside_entry {
self.add_statements(vec![ir::IRStatement::Push(
*self
.program_state
.entry_function_state
.variable_addresses
.get(&name)
.unwrap() as f32,
)]);
self.visit_expression(variable_assignment_statement.expression.clone());
self.add_statements(vec![ir::IRStatement::Mov]);
self.add_statements(vec![
ir::IRStatement::Push(
*self
.program_state
.entry_function_state
.variable_addresses
.get(&name)
.unwrap() as f32,
),
ir::IRStatement::Mov,
]);
} else {
let index = self
.find_function_index_by_name(self.program_state.function_name.clone())
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::parser::parser as p;
use crate::utils::get_line;

fn main() {
let contents = "HAI 1.2\nI HAS A x ITZ NUMBER\nX R 3\nKTHXBYE";
let contents = "HAI 1.2\nI HAS A x ITZ NUMBER\nx R 3\nI HAS A y ITZ NUMBER R 5,x R 10\nKTHXBYE";
let lines = contents.split("\n").collect::<Vec<&str>>();

let mut l = l::Lexer::init(contents);
Expand Down

0 comments on commit 79322a5

Please sign in to comment.