This commit is contained in:
nub31
2026-02-27 22:32:29 +01:00
parent 73ecbf8e9b
commit e5227f7a99
7 changed files with 18 additions and 76 deletions

View File

@@ -1,7 +1,7 @@
set -e
pushd core
dotnet run --project ../../compiler print.nub --type=lib
dotnet run --project ../../compiler mem.nub print.nub --type=lib
popd
pushd math

4
examples/core/mem.nub Normal file
View File

@@ -0,0 +1,4 @@
module core
export extern func malloc(size: u64): ^void
export extern func free(size: ^void)

View File

@@ -1,8 +1,5 @@
module core
export extern func malloc(size: u64): ^void
export extern func free(size: ^void)
extern func puts(text: ^u8)
export func print(text: string)

View File

@@ -1,32 +0,0 @@
module main
let global: i32
func main(): i32 {
let x: i32 = 23
x = 24
if !true {
x = 49
return x
} else {
x = 3
}
let i: i32 = 0
x = 1 + 2 * 34
while i < 10 {
i = i + 1
x = i
}
let me: test::person = struct test::person { age = 21 name = "Oliver" }
x = test::do_something(me.name)
test::do_something(me.name)
main::global = 123
return main::global
}

View File

@@ -1,10 +0,0 @@
module test
export packed struct person {
age: i32
name: string
}
export func do_something(name: string): i32 {
return 3
}