language: implement proper virtual machine support

This commit is contained in:
2023-11-28 05:23:48 -08:00
parent 8951c3cd60
commit f2ff23e9be
55 changed files with 312 additions and 63 deletions

View File

@ -1,9 +1,9 @@
/* fibonacci sequence */
func fib(n) {
return if n < 2 {
n
if n < 2 {
return n
} else {
fib(n - 1) + fib(n - 2)
return fib(n - 1) + fib(n - 2)
}
}

View File

@ -1,6 +1,5 @@
let items = ["Hello", "Goodbye"]
export func main() {
let items = ["Hello", "Goodbye"]
for item in items {
println(item)
}

6
examples/list.pork Normal file
View File

@ -0,0 +1,6 @@
export func main() {
let items = listInitWith(30, 0)
for item in items {
println(item)
}
}