Core: Cleanup todos

This commit is contained in:
Krzosa Karol
2023-04-22 09:34:19 +02:00
parent 8c0b4439af
commit d244608571
3 changed files with 51 additions and 68 deletions

View File

@@ -1,6 +1,4 @@
/*@language_todo: make polymorphism checking more robust*/
/*@language_todo: labeled block
/*@language_todo: labeled block :LabeledBlock
It acts just like a scope in C.
BUT it can be turned into a goto label by adding another semicolon

View File

@@ -572,7 +572,7 @@ void next(Ast_Iter *iter) {
case AST_UNION:
case AST_ENUM:
case AST_LAMBDA:
case AST_TYPE: // @cleanup: what is this used for?
case AST_TYPE:
case AST_CONST:
case AST_VAR: {
Ast_Decl *node = (Ast_Decl *)ast;

View File

@@ -1,78 +1,63 @@
/*
@! Dont fully rely on files!!!
@! Language.core shouldnt be a file!
@! Nice way of creating valid declarations programatically
@! Add a token global that implies Ast is in the executable
@! Ast_Module should be Ast_File
@! Stringify Core_Message list
Features
- Labeled blocks / gotos :LabeledBlock
- Add := for default arguments in lambda. (a := false, b := false)
- Add struct default values.
- Add for loop:
- for i: int = 0, i < 10, i+=1
- for diff: array
- iterator how to do this without function poly ? for it := iter_begin(), iter_valid(), iter_advance()
- Defer
- Expand macros
@! Separate out the codegen stage cause that can change
@! Look into String_Builders in Core_Ctx
@! Look into stage allocator and perhaps
use it more often to reduce scenarios
with 2 allocators, and simplify stuff
@! Cleanup big int allocator
- Using directive to bring symbols into local scope
- Other kinds of casts, a cast from structs of same layout, a cast without conversion
- Inject symbols into a declaration / namespace ??
- Optionally pass size and alignment calculations to C ?
@! Clean way to free all memory and reset the compiler
@! Bring the Table<>
Cleanup
- Look into unifying lambda expressions and lambda declarations
- Ast_Module shouldn't require Ast_File to hold declarations etc. I think
core_create_namespace("memes", {
- Look into a different way of passing arguments in typechecking
- Separate out the codegen stage cause that can change
- Robust c declaration generation
- Nicer / more readable expression generation
- Detecting if return was called
- Look into String_Builders in Core_Ctx
- Look into stage allocator and perhaps
use it more often to reduce scenarios
with 2 allocators, and simplify stuff
- Clean way to free all memory and reset the compiler
- Bring the table?
- Nice way of creating valid declarations programatically
core_create_namespace("memes", {
core_basic_type(
}, 4);
}, 4);
Fix backlog
- [ ] Fix and decide what to do when initializing global variable using not constants C:/AProgramming/cparse/compiler/modules/Language.core:180:28: error: initializer element is not a compile-time constant
- [ ] Test and bulletproof any, slices
- [ ] Test suite that expects test to error out
- [ ] String declaration in Language.core this way we can compound create it and access fields and stuff
- [ ] This error is valid error case when someone creates a compound out of basic type C:/AProgramming/cparse/compiler/examples/arms_race/arms_race.core:137 Internal compiler error: Invalid type was passed to the compound expression, should have been an array, struct or slice
Robustness
- Test suite that expects test to error out
- Fix and decide what to do when initializing global variable using not constants C:/AProgramming/cparse/compiler/modules/Language.core:180:28: error: initializer element is not a compile-time constant
- Test and bulletproof any, slices
- This error is valid error case when someone creates a compound out of basic type C:/AProgramming/cparse/compiler/examples/arms_race/arms_race.core:137 Internal compiler error: Invalid type was passed to the compound expression, should have been an array, struct or slice
result := String{data, filesize}
- [ ] How to cast from U64 to pointer?
```
Future features
Bytecode interpreter
- Ir
- Interpreter
- Code generation
- [ ] Other kinds of casts, a cast from structs of same layout, a cast without conversion
- [ ] Inject symbols into a declaration / namespace ??
- [ ] Using directive to bring symbols into local scope
###
- [ ] Way to import and force evaluate #import_lazy #import ?
Redesign:
- [ ] Casting syntax
In the future
- [ ] Cleanup
- [ ] Add ability to do i: int = 0 inside for loops for i: int = 0, i < 10, i+=1
- [ ] Complicated c declaration generation
- [ ] Expand macros
- [ ] Defer
- [ ] Basic
- [ ] Detecting if return was called
- [ ] Programming constructs
- [ ] Using language construct
- [ ] Named loops and breaking out of them
- [ ] Bytecode interpreter
- [ ] Ir
- [ ] Interpreter
- [ ] Code generation
Fun
- Inject stack traces into the program
- Inject instrumentation into the program
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 ?
- Constant arrays that evaluate fully at compile time
- Rust like enum where you associate values(other structs) with key
*/
#include "core_compiler_includes.cpp"