Before adding untyped types

This commit is contained in:
Krzosa Karol
2022-06-01 21:38:39 +02:00
parent 75985de125
commit ebb21df015
6 changed files with 178 additions and 152 deletions

View File

@@ -32,6 +32,7 @@ For now I don't thing it should be overloadable.
-------------------------------------------------------------------------------
@todo
[ ] - Test new operators, add constant eval for them
[ ] - Compiling and running a program
[ ] - Passing down program to compile through command line
[ ] - More operators
@@ -39,15 +40,21 @@ For now I don't thing it should be overloadable.
[ ] - Fixing access to constants, in C we cant have constants inside of structs / functions so we need to rewrite the tree
[ ] - Default values in structs??? Should compound stmts bring values from default values?? Maybe not? Whats the alternative
[ ] - Write up on order independent declarations
[ ] - Order independent declarations in structs
[ ] - Switch
[ ] - More basic types
[ ] - Array of inferred size
[ ] - Add single line lambda expressions
[ ] - Ternary operator
[ ] - Constants embeded in structs should be able to refer to other constants in that namespace without prefix
[ ] - Order independent constants in structs
[ ] - Can you even have recursive lambdas in structs, other recursive stuff
[ ] - Casting to basic types by call S64(x)
[ ] - Type aliases :: should probably be strictly typed, but assigning constant values should work
@ideas
[ ] - [Using] keyword that brings in the struct enviroment into current scope etc.
[ ] - Constant arrays that evaluate fully at compile time
[ ] - Rust like enum where you associate values(other structs) with keys
@donzo
[x] - lvalue, rvalue concept so we cant assign value to some arbitrary weird expression
@@ -78,10 +85,6 @@ For now I don't thing it should be overloadable.
#include "typecheck.h"
#include "typecheck.cpp"
#include "ccodegen.cpp"
int main(){
test_os_memory();
@@ -102,17 +105,17 @@ int main(){
printf("%s", result.str);
result = compile_file("order1.kl"_s);
printf("%s", result.str);
result = compile_file("order2.kl"_s);
printf("%s", result.str);
result = compile_file("lambdas.kl"_s);
printf("%s", result.str);
result = compile_file("order2.kl"_s);
printf("%s", result.str);
#endif
result = compile_file("lexer.kl"_s);
FILE *f = fopen("program.c", "w");
assert(f);
fprintf(f, "%.*s", (int)result.len, result.str);
fclose(f);
// result = compile_file("lexer.kl"_s);
// FILE *f = fopen("program.c", "w");
// assert(f);
// fprintf(f, "%.*s", (int)result.len, result.str);
// fclose(f);
// __debugbreak();
__debugbreak();
}