mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 08:24:05 +02:00
compiler: simple hello world doesn't work
This commit is contained in:
parent
9881b55521
commit
14d5afcaea
@ -114,7 +114,7 @@ export class AsmGen {
|
||||
}
|
||||
|
||||
const argRegs = ["rdi", "rsi", "rdx", "rcx", "r8", "r9"];
|
||||
for (const reg of argRegs.slice(0, args + 1)) {
|
||||
for (const reg of argRegs.slice(0, args)) {
|
||||
this.writeIns(`pop ${reg}`);
|
||||
}
|
||||
|
||||
|
@ -11,25 +11,21 @@ fn factorial(v: int) -> int {
|
||||
return v * factorial(v - 1);
|
||||
}
|
||||
|
||||
fn return_void_ptr(ptr: *()) -> *() {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#[c_export("sbc_main")]
|
||||
fn main() -> int {
|
||||
let i = 0;
|
||||
|
||||
// while i < 10 {
|
||||
//
|
||||
// println("Hello\ world");
|
||||
//
|
||||
// i = i + 1;
|
||||
// }
|
||||
while i < 10 {
|
||||
// print_int(i);
|
||||
println("Hello\ world");
|
||||
|
||||
let a = factorial(5);
|
||||
|
||||
print_int(a);
|
||||
i = i + 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#[c_export("sbc_main")]
|
||||
fn sbc_main() -> int {
|
||||
main();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user