Closed ammarbinfaisal closed 8 months ago
in x86_64
fun factorial(n: int) -> int {
print(n)
if n == 1 { return 1 }
return n * factorial(n - 1)
}
fun main() {
print(factorial(15))
}
outputs
15
1
gotta fix this
Not emitting x86 asm anymore
Before https://github.com/abooishaaq/sahl/commit/4b152e79ac5ca539411ba552ce581bc8ed6bff94 fibonacci.sahl and factorial.sahl were segfaulting. Now, fibonacci works fine but factorial does something weird.
this outputs
but if we remove the print statement it outputs correctly!!