Add string accessors, working towards first program

This commit is contained in:
Krzosa Karol
2022-06-03 21:59:51 +02:00
parent 827cad0127
commit 5e798bd179
8 changed files with 191 additions and 115 deletions

View File

@@ -32,23 +32,26 @@ For now I don't thing it should be overloadable.
-------------------------------------------------------------------------------
@todo
[ ] - Operators: Bit negation, Not
[ ] - Converting from U64 token to S64 Atom introduces unnanounced error (negates) - probably need big int
[ ] - Compiling and running a program
[ ] - Passing down program to compile through command line
[ ] - More for loop variations
[ ] - 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
[ ] - Switch
[ ] - More basic types
[ ] - Comma notation when declaring variables thing1, thing2: S32
[ ] - Array of inferred size
[ ] - Add single line lambda expressions
[ ] - Ternary operator
[ ] - Field access rewrite
[ ] - Constants embeded in structs should be able to refer to other constants in that namespace without prefix
[ ] - Converting from U64 token to S64 Atom introduces unnanounced error (negates) - probably need
[ ] - Order independent constants in structs
[ ] - Can you even have recursive lambdas in structs, other recursive stuff
[ ] - Fix recursive lambdas in structs
[ ] - Fixing access to functions/structs, in C we cant have functons inside of structs / functions so we need to rewrite the tree
[ ] - 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
[ ] - Type aliases :: should probably be strictly typed, but assigning constant values should work
@ideas
@@ -59,16 +62,19 @@ For now I don't thing it should be overloadable.
@donzo
[x] - Test new operators, add constant eval for them
[x] - lvalue, rvalue concept so we cant assign value to some arbitrary weird expression
[x] - More basic types
[x] - Add basic support for floats
[x] - Add basic setup for new type system
[x] - Access through struct names to constants Arena.CONSTANT
[x] - Enums
[x] - Initial for loop
[x] - Enum . access to values
[x] - Infinite for loop
[x] - in new typesystem: Fix calls, fix all example programs
[x] - Fix arithmetic operations in new type system
[x] - Init statements, different kinds [+=] [-=] etc.
[x] - Struct calls
[x] - Operators: Bit negation, Not
[x] - Default values in calls
[x] - Resolving calls with default values
[x] - Pass statement
@@ -119,11 +125,11 @@ int main(){
result = compile_file("new_types.kl"_s);
printf("%s", result.str);
// 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("program.kl"_s);
FILE *f = fopen("program.c", "w");
assert(f);
fprintf(f, "%.*s", (int)result.len, result.str);
fclose(f);
__debugbreak();
}