mirror of
https://github.com/Mercantec-GHC/h4-projekt-gruppe-0-sm.git
synced 2025-04-27 16:24:07 +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"];
|
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}`);
|
this.writeIns(`pop ${reg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,25 +11,21 @@ fn factorial(v: int) -> int {
|
|||||||
return v * factorial(v - 1);
|
return v * factorial(v - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn return_void_ptr(ptr: *()) -> *() {
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[c_export("sbc_main")]
|
|
||||||
fn main() -> int {
|
fn main() -> int {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
// while i < 10 {
|
while i < 10 {
|
||||||
//
|
// print_int(i);
|
||||||
// println("Hello\ world");
|
println("Hello\ world");
|
||||||
//
|
|
||||||
// i = i + 1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
let a = factorial(5);
|
i = i + 1;
|
||||||
|
}
|
||||||
print_int(a);
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[c_export("sbc_main")]
|
||||||
|
fn sbc_main() -> int {
|
||||||
|
main();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user