Update todo

This commit is contained in:
Krzosa Karol
2022-05-30 18:55:15 +02:00
parent a9b0318720
commit 5e0aabb1cb
3 changed files with 53 additions and 51 deletions

View File

@@ -1,4 +1,3 @@
a_type :: int a_type :: int
pointer_type :: *int pointer_type :: *int
null_pointer: pointer_type = null null_pointer: pointer_type = null
@@ -15,17 +14,12 @@ if_stmt :: (cond: int): type
add_10 :: (size: int): int add_10 :: (size: int): int
// @todo: before the generation c pass, each stage should have it's own
// tree transformation phase, where it yanks functions out etc.
add_20 :: (new_size: int): int add_20 :: (new_size: int): int
return 20 return 20
add :: (a: int, b: int = 10): int add :: (a: int, b: int = 10): int
return a + b return a + b
// thing_2 :: (a: int = "String")
// return
constant :: 20; result := constant + 10 constant :: 20; result := constant + 10
v3 := add(1,2) v3 := add(1,2)

View File

@@ -6,49 +6,58 @@
#include "typechecking.cpp" #include "typechecking.cpp"
#include "ccodegen.cpp" #include "ccodegen.cpp"
// 2022.05.28 - On lambda expressions /*
// I think it's not wise to add the multiline lambda expressions 2022.05.28 - On lambda expressions
// As is the case with python it would require new alternative syntax. I think it's not wise to add the multiline lambda expressions
// The idea was to imply that the whitespace significant syntax is just As is the case with python it would require new alternative syntax.
// inserting '{' '}' ';' automatically and if you decide to write a brace The idea was to imply that the whitespace significant syntax is just
// it stops being whitespace significant and you can type everything with semicolons and braces inserting '{' '}' ';' automatically and if you decide to write a brace
// Problem is first of all it's kind of weird to have a completly different syntax it stops being whitespace significant and you can type everything with semicolons and braces
// in a language to solve something that is a minor inconvenience, Problem is first of all it's kind of weird to have a completly different syntax
// second of all it turned out to be kind of bad, maybe if it would be more in a language to solve something that is a minor inconvenience,
// complicated then it would be ok but it implies that you have to semicolon end second of all it turned out to be kind of bad, maybe if it would be more
// a lot of thing unintuitively. complicated then it would be ok but it implies that you have to semicolon end
a lot of thing unintuitively.
// //
// Probably single line lambdas should be ok. Currently braces turn off indentation Probably single line lambdas should be ok. Currently braces turn off indentation
// awareness. There might be something you can do by trying to turn that on awareness. There might be something you can do by trying to turn that on
// problem is that complicates parsing a lot cause you have to account for multiple problem is that complicates parsing a lot cause you have to account for multiple
// indent styles, which means error messages become bad. indent styles, which means error messages become bad.
// 2022.05.30 - On constructors and compound expressions 2022.05.30 - On constructors and compound expressions
// I unified the compound expression syntax (Type){} with function call syntax Type(). I unified the compound expression syntax (Type){} with function call syntax Type().
// It's differentiating on whether you used type. I think there is a benefit to the language It's differentiating on whether you used type. I think there is a benefit to the language
// not having an idea of overloading the type constructor. You will always know what will happen. not having an idea of overloading the type constructor. You will always know what will happen.
// Unlike C++ for example. It seems like a minefield that can fuck your mind up. So many corner cases Unlike C++ for example. It seems like a minefield that can fuck your mind up. So many corner cases
// and variants. having the idea of compounds doing one thing is reassuring I think. and variants. having the idea of compounds doing one thing is reassuring I think.
// You can always do a constructor by writing a function with lower case type if you want that. You can always do a constructor by writing a function with lower case type if you want that.
// For now I don't thing it should be overloadable. For now I don't thing it should be overloadable.
//
/// @todo
/// [x] - Typespecs should probably be expressions so stuff like would be possible :: *[32]int @todo
/// [x] - Initial order independence algorithm [ ] - Enums
/// [ ] - Cleanup the mess with constant bindings [ ] - Enum . access to values
/// [x] - Struct calls [ ] - Fixing access to constants, in C we cant have constants inside of structs / functions so we need to rewrite the tree
/// [x] - Default values in calls [ ] - Access through struct names to constants Arena.CONSTANT
/// [x] - Resolving calls with default values [ ] - Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative
/// [x] - Resolving calls with named args, with indexed args [ ] - For loop
/// [x] - Structs [ ] - Switch
/// [ ] - Default values in structs??? [ ] - Lexer: Need to insert scope endings when hitting End of file
/// [ ] - Enums [ ] - Add single line lambda expressions
/// [ ] - For loop
/// [ ] - Switch @donzo
/// [ ] - Think about compound expressions, unify with calls - maybe Thing(a=1) instead of Thing{a=1} [x] - Struct calls
/// [ ] - Lexer: Need to insert scope endings when hitting End of file [x] - Default values in calls
/// [ ] - Add single line lambda expressions/ [x] - Resolving calls with default values
[x] - Resolving calls with named args, with indexed args
[x] - Structs
[x] - Struct field access
[x] - Struct field access with dots while compiling to arrows in c
[x] - Typespecs should probably be expressions so stuff like would be possible :: *[32]int
[x] - Initial order independence algorithm
[x] - Think about compound expressions, unify with calls - maybe Thing(a=1) instead of Thing{a=1}
*/
int main(){ int main(){

View File

@@ -1,5 +1,4 @@
Str16 :: String16 Str16 :: String16
arena_pointer: *Arena = null arena_pointer: *Arena = null
thing: Arena thing: Arena
no_type := thing no_type := thing
@@ -19,11 +18,11 @@ Arena :: struct
len : int len : int
cap : int cap : int
constant_inside :: 10000
constant_outside :: 10000
get_len :: (s: *Arena): int get_len :: (s: *Arena): int
return s.next.constant_inside return s.next.len
constant_inside :: 10000
string16: Str16 string16: Str16