quite a few fixes, overall repo cleanup and some restructurization in the stdlib

This commit is contained in:
IgorCielniak
2026-01-12 19:03:49 +01:00
parent 3f87f12cf1
commit 47a45c050e
25 changed files with 582 additions and 648 deletions

View File

@@ -1,2 +0,0 @@
42
3

View File

@@ -1,16 +0,0 @@
import ../stdlib/stdlib.sl
import ../stdlib/io.sl
import ../fn.sl
word main
2 40 +
puti cr
extend-syntax
foo(1, 2)
puti cr
0
end
fn foo(int a, int b){
return a + b;
}

View File

@@ -1 +0,0 @@
python main.py tests/call_syntax_parens.sl -o /tmp/call_syntax_parens > /dev/null && /tmp/call_syntax_parens

View File

@@ -30,4 +30,3 @@
111
222
16
70

View File

@@ -1,6 +1,5 @@
import ../stdlib/stdlib.sl
import ../stdlib/io.sl
import ../fn.sl
:asm mem-slot {
lea rax, [rel print_buf]
@@ -33,12 +32,6 @@ struct: Point
field y 8
;struct
extend-syntax
fn fancy_add(int a, int b){
return (a + b) * b;
}
word test-add
5 7 + puti cr
end
@@ -161,13 +154,6 @@ word test-cmp
4 5 >= puti cr
end
word test-c-fn
3
7
fancy_add()
puti cr
end
word main
test-add
test-sub
@@ -186,6 +172,5 @@ word main
test-for-zero
test-cmp
test-struct
test-c-fn
0
end

4
tests/str.expected Normal file
View File

@@ -0,0 +1,4 @@
1
g
g
hello world hello world hello world hello world hello world

15
tests/str.sl Normal file
View File

@@ -0,0 +1,15 @@
import stdlib.sl
word main
"g" "g"
strcmp
puti cr
puts
puts
"hello world hello world hello " "world hello world hello world"
strconcat
2dup
puts
free
end

1
tests/str.test Normal file
View File

@@ -0,0 +1 @@
python main.py tests/str.sl -o /tmp/str > /dev/null && /tmp/str

View File

@@ -0,0 +1,2 @@
1235
1235

9
tests/typeconversion.sl Normal file
View File

@@ -0,0 +1,9 @@
import stdlib.sl
word main
"1234" toint 1 + dup puti cr
tostr
2dup
puts
free
end

View File

@@ -0,0 +1 @@
python main.py tests/typeconversion.sl -o /tmp/typeconversion > /dev/null && /tmp/typeconversion

View File

@@ -1 +0,0 @@
7

View File

@@ -1,12 +0,0 @@
import ../stdlib/stdlib.sl
import ../stdlib/io.sl
word add-two
+
end
word main
3 4 add-two
puti cr
0
end

View File

@@ -1 +0,0 @@
python main.py tests/word_syntax.sl -o /tmp/word_syntax > /dev/null && /tmp/word_syntax