Removing heap allocations, Porting to Unix

This commit is contained in:
Krzosa Karol
2022-10-09 10:34:23 +02:00
parent aa2b4d90e4
commit b22e1ac0db
13 changed files with 260 additions and 269 deletions

View File

@@ -1,10 +1,14 @@
/*
First doable version:
Current:
- [ ] Foreign import that would link library
- [ ] String in Language.core
- [ ] Way to import and force evaluate #import_lazy #import ?
- [ ] Unix port
- [ ] Imports are leaking names ! Multimedia leaks windows stuff
- [ ] Test and bulletproof any, slices
- [ ] Include multiple pattern matched imports "unix_" and "linux_" both should be included on linux
In the future
@@ -12,7 +16,6 @@ In the future
- [ ] Add ability to do i: int = 0 inside for loops for i: int = 0, i < 10, i+=1
- [ ] Complicated c declaration generation
- [ ] Way to import and force evaluate #import_lazy #import ?
- [ ] Expand macros
- [ ] Defer
@@ -37,14 +40,15 @@ In the future
- [ ] Parametric Polymorphism
- [ ] Conditional compilation #if (maybe just do something like a conditional load or import?) #import "windows.kl" when os == "windows"
Ideas
- [ ] #test construct that would gather all tests and run them on start of program or something
- [ ] Inject stack traces into the program
- [ ] Constant arrays that evaluate fully at compile time
- [ ] Rust like enum where you associate values(other structs) with key
- [ ] Cast from array to pointer?
- [ ] Ternary operator?
- [ ] Optionally pass size and alignment calculations to C ?
- [ ] Any
- [ ] Assigning to any values like ints etc. should work perhaps? But what type they should have?
- [ ] Slice of Any should work well
Maybe later
- [ ] Optionally pass size and alignment calculations to C ?
-------------------------------------------------------------------------------
@@ -117,36 +121,6 @@ For modules it's a bit different cause they should be distributed as valid.
-------------------------------------------------------------------------------
- [ ] Probably need to give Ast_Expr a Value field, then I can express Type nicely
- [ ] I would love for String, slice, Any etc. to have their struct declarations in source files, I also would want for stuff like string.str to work without weird special cases
- [ ] Var args with Any
- [ ] #test construct that would gather all tests and run them on start of program or something
- [ ] Foreign import that would link library
- [ ] Kilobyte, Megabyte, Gigabyte
- [ ] Cast from array to pointer?
- [ ] Fix field access, cant cast, cant index
- [ ] Add parent_scope to Ast_Type, Add name to Ast_Type?
- [ ] Optional function renaming in codegen
- [ ] Using in structs to embed members, then casting offsets to that embedded member
- [ ] Comma notation when declaring variables thing1, thing2: S32 :: probably want to unify it with var unpacking
- [ ] Add single line lambda expressions
- [ ] Ternary operator
- [ ] Write up on order independent declarations
- [ ] constructor => thing :: (i: S32) -> {i = i, thing = 10}
- [ ] Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative
@ideas
- [ ] Var args using Any array - args: []Any - delete vargs
- [ ] Constant arrays that evaluate fully at compile time
- [ ] Rust like enum where you associate values(other structs) with keys
- [ ] Compound that zeros values - .{} , Compound that assumes defaults from struct definition - {}
- [ ] Inject stack traces into the program
## Done
@@ -247,7 +221,15 @@ For modules it's a bit different cause they should be distributed as valid.
#include "base.cpp"
#include "base_unicode.cpp"
#if OS_WINDOWS
#include "os_windows.cpp"
#elif OS_UNIX
#include "os_unix.cpp"
#else
#error Couldnt figure out OS using macros
#endif
#include "c3_big_int.h"
#include "core_compiler.h"
#include "core_types.h"
@@ -307,5 +289,5 @@ int main(int argument_count, char **arguments){
compile_file(it.absolute_path, COMPILE_AND_RUN | COMPILE_TESTING);
}
}
__debugbreak();
return 0;
}