Begin structs, add comment on multiline lambdas, add Ast flags

This commit is contained in:
Krzosa Karol
2022-05-29 11:29:26 +02:00
parent 7de941899f
commit 07b793aacc
7 changed files with 116 additions and 26 deletions

View File

@@ -7,8 +7,32 @@
#include "new_resolve.cpp"
#include "ccodegen.cpp"
// 2022.05.28 - On lambda expressions
// I think it's not wise to add the multiline lambda expressions
// As is the case with python it would require new alternative syntax.
// The idea was to imply that the whitespace significant syntax is just
// inserting '{' '}' ';' automatically and if you decide to write a brace
// it stops being whitespace significant and you can type everything with semicolons and braces
// Problem is first of all it's kind of weird to have a completly different syntax
// in a language to solve something that is a minor inconvenience,
// second of all it turned out to be kind of bad, maybe if it would be more
// 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
// 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
// indent styles, which means error messages become bad.
/// @todo
/// [x] - Typespecs should probably be expressions so stuff like would be possible :: *[32]int
/// [ ] - Add single line lambda expressions/
/// [ ] - Think about compound expressions, unify with calls - maybe Thing(a=1) instead of Thing{a=1}
/// [ ] - Structs
/// [ ] - Enums
/// [ ] - For loop
/// [ ] - Switch
int main(){
@@ -23,8 +47,8 @@ int main(){
test_intern_table();
lex_test();
String result = compile_file("globals.kl"_s);
// String result = compile_file("lambdas.kl"_s);
// String result = compile_file("globals.kl"_s);
String result = compile_file("structs.kl"_s);
// String result = compile_file("order_independent_globals.kl"_s);
printf("%s", result.str);