This commit is contained in:
nub31
2025-01-29 21:39:55 +01:00
parent 39be4d823b
commit d685fe2209
12 changed files with 205 additions and 1 deletions

View File

@@ -1,7 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<attachedFolders>
<Path>../input</Path>
<Path>../output</Path>
</attachedFolders>
<explicitIncludes />
<explicitExcludes />
</component>

View File

@@ -1,29 +0,0 @@
let SYS_WRITE = 1;
let STD_OUT = 1;
let STD_ERR = 2;
func print(msg: String) {
syscall(SYS_WRITE, STD_OUT, msg, strlen(msg));
}
func print(value: bool) {
if value {
print("true");
} else {
print("false");
}
}
func println() {
print("\n");
}
func println(msg: String) {
print(msg);
println();
}
func println(value: bool) {
print(value);
println();
}

View File

@@ -1,13 +0,0 @@
global strlen
section .text
strlen:
xor rax, rax
.loop:
cmp byte [rdi], 0
jz .done
inc rax
inc rdi
jmp .loop
.done:
ret

View File

@@ -1 +0,0 @@
extern func strlen(msg: String): int64;

View File

@@ -1,16 +0,0 @@
import "core";
func main() {
println("test");
println(true);
if strlen("1") == 1 {
println("1");
} else if false {
println("2");
} else if true {
println("3");
} else {
println("4");
}
}

View File

@@ -1,5 +0,0 @@
#!/bin/sh
nasm -g -felf64 out.asm -o out.o
nasm -g -felf64 ../input/core/strlen.asm -o strlen.o
ld -o out out.o strlen.o

View File

@@ -1,3 +0,0 @@
#!/bin/sh
./build.sh
gdb -tui out

View File

@@ -1,4 +0,0 @@
#!/bin/sh
./build.sh
./out
echo "Process exited with status code $?"