Add file listing

This commit is contained in:
Krzosa Karol
2022-06-27 09:17:53 +02:00
parent 06dcb718fd
commit 02ec291ad0
4 changed files with 22 additions and 31 deletions

View File

@@ -58,7 +58,7 @@ For modules it's a bit different cause they should be distributed as valid.
@todo @todo
[ ] - Split Bc into builder and interpreter [ ] - Split Bc into builder and interpreter
[ ] - Implement functions [ ] - Implement functions in the bytecode
[ ] - Probably need to give Ast_Expr a Value field, then I can express Type nicely [ ] - 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 [ ] - 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
@@ -69,13 +69,11 @@ For modules it's a bit different cause they should be distributed as valid.
[ ] - Builtin dynamic arrays [ ] - Builtin dynamic arrays
[ ] - Kilobyte, Megabyte, Gigabyte [ ] - Kilobyte, Megabyte, Gigabyte
[ ] - Cast from array to pointer? [ ] - Cast from array to pointer?
[ ] - Mixing loads and imports leads to code duplication, is that what we want???
[ ] - Fix field access, cant cast, cant index [ ] - Fix field access, cant cast, cant index
[ ] - Add parent_scope to Ast_Type, Add name to Ast_Type? [ ] - Add parent_scope to Ast_Type, Add name to Ast_Type?
[ ] - Some way to take slice of data [ ] - Some way to take slice of data
[ ] - Optional function renaming in codegen [ ] - Optional function renaming in codegen
[ ] - Using in structs to embed members, then casting offsets to that embedded member [ ] - Using in structs to embed members, then casting offsets to that embedded member
[ ] - Type as a parameter to a function, alloc :: (size: U64, type: Type)
[ ] - Comma notation when declaring variables thing1, thing2: S32 :: probably want to unify it with var unpacking [ ] - Comma notation when declaring variables thing1, thing2: S32 :: probably want to unify it with var unpacking
[ ] - Add single line lambda expressions [ ] - Add single line lambda expressions
@@ -100,7 +98,9 @@ For modules it's a bit different cause they should be distributed as valid.
[ ] - Polymorphism - create declaration of a polymorphic thing, when it's called just copy it, replace types and typecheck normally, when someone calls again you just search for the instantiation again [ ] - Polymorphism - create declaration of a polymorphic thing, when it's called just copy it, replace types and typecheck normally, when someone calls again you just search for the instantiation again
@donzo @donzo
[x] - Type as a parameter to a function, alloc :: (size: U64, type: Type)
[x] - Add token information to instructions [x] - Add token information to instructions
[-] - Mixing loads and imports leads to code duplication, is that what we want???
[x] - print those token lines nicely [x] - print those token lines nicely
[x] - Improve the python metaprogram [x] - Improve the python metaprogram
[x] - Implementing type Any [x] - Implementing type Any
@@ -175,6 +175,7 @@ For modules it's a bit different cause they should be distributed as valid.
#include "base.cpp" #include "base.cpp"
#include "base_unicode.cpp" #include "base_unicode.cpp"
#include "os_windows.cpp"
#include "big_int_c3.cpp" #include "big_int_c3.cpp"
#include "compiler.h" #include "compiler.h"
#include "lexing.cpp" #include "lexing.cpp"
@@ -220,6 +221,12 @@ int main(int argument_count, char **arguments){
test_intern_table(); test_intern_table();
test_bucket_arrays(); test_bucket_arrays();
Scratch scratch;
String a = os_get_working_dir(scratch);
String b = os_get_exe_dir(scratch);
Array<OS_File_Info> files = os_list_dir(scratch, ".."_s, LIST_RECURSE_INTO_DIRS);
emit_line_directives = true; emit_line_directives = true;
String program_name = "main.kl"_s; String program_name = "main.kl"_s;
if(argument_count > 1){ if(argument_count > 1){
@@ -252,9 +259,6 @@ int main(int argument_count, char **arguments){
arena_clear(&pctx->stage_arena); arena_clear(&pctx->stage_arena);
// build_bytecode();
// compile_to_bc();
// __debugbreak();
String result = get_compilation_result(); String result = get_compilation_result();
assert(os_write_file("program.c"_s, result)); assert(os_write_file("program.c"_s, result));
{ {

View File

@@ -64,7 +64,6 @@ test_type :: ()
t51 := get_type_info(t5.base_type) t51 := get_type_info(t5.base_type)
assert(t51.kind == Type_Info_Kind.ARRAY) assert(t51.kind == Type_Info_Kind.ARRAY)
t6 := get_type_info(type6) t6 := get_type_info(type6)
t61 := get_type_info(t6.base_type) t61 := get_type_info(t6.base_type)
t62 := get_type_info(t61.base_type) t62 := get_type_info(t61.base_type)

View File

@@ -3,7 +3,6 @@ SizeU :: U64
arena_di: U64 arena_di: U64
Arena :: struct Arena :: struct
// allocator: Allocator
di: U64 // @debug_id di: U64 // @debug_id
memory: Os.Memory memory: Os.Memory
alignment: U64 alignment: U64
@@ -48,32 +47,19 @@ arena_push_size :: (a: *Arena, size: SizeU): *void
a.len += size a.len += size
return result return result
// @todo: Make this compile time thing!!!
// This probably will wait till polymorphism stuff
// something like this:
// arena_push_type :: (a: *Arena, type: $T): *T
//
arena_push_type :: (a: *Arena, type: Type): *void
type_info := get_type_info(type)
assert(type_info != 0)
return arena_push_size(a, type_info.size->SizeU)
arena_release :: (a: *Arena) arena_release :: (a: *Arena)
Os.release(&a.memory) Os.release(&a.memory)
/*
ALLOCATOR_ACTION :: enum
ALLOCATE
RESIZE
FREE_ALL
Allocator :: struct
proc: (a: *Allocator, action: ALLOCATOR_ACTION, size: SizeU, old_pointer: *void): *void
arena_allocator_proc :: (a: *Allocator, action: ALLOCATOR_ACTION, size: SizeU, old_pointer: *void): *void
arena: *Arena = a->*Arena
if action == ALLOCATOR_ACTION.ALLOCATE
return arena_push_size(arena, size)
elif action == ALLOCATOR_ACTION.RESIZE
pass
elif action == ALLOCATOR_ACTION.FREE_ALL
pass
else;; assert(false, "Invalid codepath")
return 0
allocate :: (a: *Allocator, size: SizeU): *void
return a.proc(a, ALLOCATOR_ACTION.ALLOCATE, size, 0)
*/
// //
// Unicode // Unicode

View File

@@ -139,6 +139,8 @@ WinMain :: (hInstance: HINSTANCE, hPrevInstance: HINSTANCE, lpCmdLine: LPSTR, nS
good_scheduling = true good_scheduling = true
arena: Arena arena: Arena
data: *int = arena_push_type(&arena, int)
window_name := string_to_string16(&arena, "Have a wonderful day! 豈 更 車 賈 滑 串 句 龜 ") window_name := string_to_string16(&arena, "Have a wonderful day! 豈 更 車 賈 滑 串 句 龜 ")
w := WNDCLASSW{ w := WNDCLASSW{
lpfnWndProc = window_procedure, lpfnWndProc = window_procedure,