Disable constants inside structures
This commit is contained in:
@@ -57,50 +57,50 @@ For modules it's a bit different cause they should be distributed as valid.
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
@todo
|
@todo
|
||||||
[ ] - Fix language_basics.kl string index error
|
- [ ] Split Bc into builder and interpreter
|
||||||
[ ] - Split Bc into builder and interpreter
|
- [ ] Implement functions in the bytecode
|
||||||
[ ] - 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
|
||||||
[ ] - Var args with Any
|
- [ ] Var args with Any
|
||||||
|
|
||||||
[ ] - #test construct that would gather all tests and run them on start of program or something
|
- [ ] #test construct that would gather all tests and run them on start of program or something
|
||||||
[ ] - Foreign import that would link library
|
- [ ] Foreign import that would link library
|
||||||
[ ] - Builtin dynamic arrays
|
- [ ] Builtin dynamic arrays
|
||||||
[ ] - Kilobyte, Megabyte, Gigabyte
|
- [ ] Kilobyte, Megabyte, Gigabyte
|
||||||
[ ] - Cast from array to pointer?
|
- [ ] Cast from array to pointer?
|
||||||
[ ] - 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
|
||||||
|
|
||||||
[ ] - 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
|
||||||
[ ] - Ternary operator
|
- [ ] Ternary operator
|
||||||
[ ] - Disable ability to parse inner structs, functions, constants etc. ?
|
- [ ] Disable ability to parse inner structs, functions, constants etc. ?
|
||||||
[ ] - Write up on order independent declarations
|
- [ ] Write up on order independent declarations
|
||||||
|
|
||||||
[ ] - Consider changing syntax of scopes to use braces { }
|
- [ ] Consider changing syntax of scopes to use braces { }
|
||||||
[ ] - Order independent declarations in structs ?
|
- [ ] Order independent declarations in structs ?
|
||||||
[ ] - constructor => thing :: (i: S32) -> {i = i, thing = 10}
|
- [ ] constructor => thing :: (i: S32) -> {i = i, thing = 10}
|
||||||
[ ] - Casting to basic types by call S64(x)
|
- [ ] Casting to basic types by call S64(x)
|
||||||
[ ] - Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative
|
- [ ] Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative
|
||||||
|
|
||||||
@ideas
|
@ideas
|
||||||
[ ] - Var args using Any array - args: []Any - delete vargs
|
- [ ] Var args using Any array - args: []Any - delete vargs
|
||||||
[ ] - [Using] keyword that brings in the struct enviroment into current scope etc.
|
- [ ] [Using] keyword that brings in the struct enviroment into current scope etc.
|
||||||
[ ] - Constant arrays that evaluate fully at compile time
|
- [ ] Constant arrays that evaluate fully at compile time
|
||||||
[ ] - Rust like enum where you associate values(other structs) with keys
|
- [ ] Rust like enum where you associate values(other structs) with keys
|
||||||
[ ] - Compound that zeros values - .{} , Compound that assumes defaults from struct definition - {}
|
- [ ] Compound that zeros values - .{} , Compound that assumes defaults from struct definition - {}
|
||||||
[ ] - Inject stack traces into the program
|
- [ ] Inject stack traces into the program
|
||||||
[ ] - Conditional compilation #if
|
- [ ] Conditional compilation #if
|
||||||
[ ] - 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
|
||||||
|
|
||||||
|
|
||||||
## Done
|
## Done
|
||||||
|
|
||||||
|
- [x] Fix language_basics.kl string index error
|
||||||
- [x] Type as a parameter to a function, alloc :: (size: U64, type: Type)
|
- [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???
|
- [-] Mixing loads and imports leads to code duplication, is that what we want???
|
||||||
|
|||||||
@@ -659,12 +659,13 @@ parse_struct(Token *pos){
|
|||||||
token_match(OPEN_SCOPE);
|
token_match(OPEN_SCOPE);
|
||||||
Ast_Scope *scope = begin_decl_scope(scratch, token_get());
|
Ast_Scope *scope = begin_decl_scope(scratch, token_get());
|
||||||
do{
|
do{
|
||||||
Token *token = token_get();
|
Token *token = token_expect(TK_Identifier);
|
||||||
|
token_expect(TK_Colon);
|
||||||
Ast_Decl *decl = parse_decl(false);
|
|
||||||
if(!decl) compiler_error(token, "Failed to parse struct member");
|
|
||||||
|
|
||||||
|
Ast_Expr *typespec = parse_expr();
|
||||||
|
Ast_Decl *decl = ast_var(token, typespec, token->intern_val, 0);
|
||||||
decl->flags = set_flag(decl->flags, AST_AGGREGATE_CHILD);
|
decl->flags = set_flag(decl->flags, AST_AGGREGATE_CHILD);
|
||||||
|
|
||||||
scope->decls.add(decl);
|
scope->decls.add(decl);
|
||||||
|
|
||||||
}while(token_match(SAME_SCOPE));
|
}while(token_match(SAME_SCOPE));
|
||||||
|
|||||||
@@ -2,16 +2,16 @@ Os :: #import "os_windows.kl"
|
|||||||
SizeU :: U64
|
SizeU :: U64
|
||||||
arena_di: U64
|
arena_di: U64
|
||||||
|
|
||||||
|
ADDITIONAL_COMMIT_SIZE :: 1024*1024
|
||||||
|
DEFAULT_RESERVE_SIZE :: 1024*1024*1024
|
||||||
|
DEFAULT_ALIGNMENT :: 8
|
||||||
|
|
||||||
Arena :: struct
|
Arena :: struct
|
||||||
di: U64 // @debug_id
|
di: U64 // @debug_id
|
||||||
memory: Os.Memory
|
memory: Os.Memory
|
||||||
alignment: U64
|
alignment: U64
|
||||||
len: U64
|
len: U64
|
||||||
|
|
||||||
ADDITIONAL_COMMIT_SIZE :: 1024*1024
|
|
||||||
DEFAULT_RESERVE_SIZE :: 1024*1024*1024
|
|
||||||
DEFAULT_ALIGNMENT :: 8
|
|
||||||
|
|
||||||
clamp_top_sizeu :: (val: SizeU, max: SizeU): SizeU
|
clamp_top_sizeu :: (val: SizeU, max: SizeU): SizeU
|
||||||
if val > max
|
if val > max
|
||||||
return max
|
return max
|
||||||
@@ -29,8 +29,8 @@ align_up :: (size: SizeU, align: SizeU): SizeU
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
arena_init :: (a: *Arena)
|
arena_init :: (a: *Arena)
|
||||||
a.memory = Os.reserve(a.DEFAULT_RESERVE_SIZE)
|
a.memory = Os.reserve(DEFAULT_RESERVE_SIZE)
|
||||||
a.alignment = a.DEFAULT_ALIGNMENT
|
a.alignment = DEFAULT_ALIGNMENT
|
||||||
a.di = arena_di++
|
a.di = arena_di++
|
||||||
// a.allocator.proc = arena_allocator_proc
|
// a.allocator.proc = arena_allocator_proc
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ arena_push_size :: (a: *Arena, size: SizeU): *void
|
|||||||
if a.len + generous_size > a.memory.commit
|
if a.len + generous_size > a.memory.commit
|
||||||
if a.memory.reserve == 0
|
if a.memory.reserve == 0
|
||||||
arena_init(a)
|
arena_init(a)
|
||||||
result := Os.commit(&a.memory, generous_size + a.ADDITIONAL_COMMIT_SIZE)
|
result := Os.commit(&a.memory, generous_size + ADDITIONAL_COMMIT_SIZE)
|
||||||
assert(result == true)
|
assert(result == true)
|
||||||
a.len = align_up(a.len, a.alignment)
|
a.len = align_up(a.len, a.alignment)
|
||||||
assert(a.memory.reserve > a.len + a.memory.commit)
|
assert(a.memory.reserve > a.len + a.memory.commit)
|
||||||
|
|||||||
Reference in New Issue
Block a user