It’s possible to compile kc in a single pass (with an exception of mutually recursive functions, where we need to parse multiple neighbouring functions to check if they mutually recurse), but it’s not yet implemented.
ACTUALLY, we’re remaking kc without unions yo. That’s my PLAN! This is to maybe unclog my mind (because I’m kinda stuck yo, especially on stuff that doesn’t YET matter)
I had to link libc to be able to call dynamically loaded libc functions. That’s crap and I hate it. I wonder if it’s possible to avoid it.
I assume the problem is that libc has some shit in the process reserved, so I would have to run all libc calls in a different process? And copy data between them.
external functions can also be polymorphic (easier handling of varargs functions for now.)
id (x a) -> a external cprintf(a) -> a return cprintf(x)
Right now, I’ll only do 1.
right now, all structs are ABI compatible with C, since I need it for external functions. I don’t actually want it for structs that do not interact with external stuff, because I can rearrange struct members for best alignment and reduce redundant nested enums.
This is obviously incorrect when it comes to functions with environments.
fn keywordactually, parsing functions vs variables has gotten a bit complicated. For now, I’ll introduce a keyword for functions to make parsing easier. I still want to make it like it was before, but I’ll have to think about maybe saving lexing state? I want to make this language work as soon as possible, so I’ll handle other shit later.
1 to (10) for-each(fn(x))
println(x)
1 to (10)
map(fn(x))
println(x)
return x + 1
sum()
is this good?
NEW SYNTAX JUST DROPPED (singleline multiline)
# kewl
with ('miau.txt' File.read-contents(al), fn file: file DynStr.free(), fn(file)):
lines()
free()
# or
'miau.txt'
File.read-contents(al)
with(DynStr.free, fn(line)): line
lines()
count()
println() # clearly outside of `with()`
# normal
with ('miau.txt' File.read-contents(al), fn file: file DynStr.free(), fn(file): file lines() count())
it allows me to “continue” the iterator construction outside of the parenthesis and later have a possibility of continuing