This commit is contained in:
nub31
2025-09-11 23:34:13 +02:00
parent 0fd1af7e60
commit adcc9f3580
7 changed files with 95 additions and 31 deletions

View File

@@ -1,20 +0,0 @@
module "main"
import "test"
export extern "puts" func puts(text: cstring)
struct Human
{
name: cstring
age: u64
}
func main(args: []cstring): i64
{
let me: main::Human = {
name = "Oliver"
age = 21
}
return 0
}

View File

@@ -3,8 +3,8 @@ NUBC = ../compiler/NubLang.CLI/bin/Debug/net9.0/nubc
out: .build/out.o
gcc -nostartfiles -o out x86_64.s .build/out.o
.build/out.o: $(NUBC) main.nub
$(NUBC) main.nub
.build/out.o: $(NUBC) src/main.nub src/test.nub
$(NUBC) src/main.nub src/test.nub
.PHONY: $(NUBC)
$(NUBC):

14
example/src/main.nub Normal file
View File

@@ -0,0 +1,14 @@
module "main"
import "test"
export extern "puts" func puts(text: cstring)
export struct Test1
{
test2: ^test::Test2
}
extern "main" func main(args: []cstring): i64
{
return 0
}

View File

@@ -4,7 +4,7 @@
.globl _start
_start:
mov rdi, rsp
call main.main
call main
mov rdi, rax
mov rax, 60
syscall