Fix arrays in tuples error in C gen. Better api for getting unique name.

This commit is contained in:
Krzosa Karol
2023-02-10 09:04:27 +01:00
parent d41da94c80
commit 6f8a7ba6c8
3 changed files with 57 additions and 88 deletions

View File

@@ -162,7 +162,7 @@ struct Token{
union{
String string;
struct{
uint8_t *str;
uint8_t *str;
int64_t len;
};
};
@@ -232,11 +232,11 @@ struct Value {
Ast_Type *type;
Ast_Decl *resolved_decl;
union {
bool bool_val;
double f64_val;
Intern_String intern_val;
bool bool_val;
double f64_val;
Intern_String intern_val;
BigInt big_int_val;
Ast_Type *type_val;
Ast_Type *type_val;
};
/*END*/
};
@@ -254,11 +254,11 @@ struct Ast_Resolved_Member{
Ast_Type *type;
Ast_Decl *resolved_decl;
union {
bool bool_val;
double f64_val;
Intern_String intern_val;
bool bool_val;
double f64_val;
Intern_String intern_val;
BigInt big_int_val;
Ast_Type *type_val;
Ast_Type *type_val;
};
};
};
@@ -398,11 +398,11 @@ struct Ast_Atom: Ast_Expr{
Ast_Type *type;
Ast_Decl *resolved_decl;
union {
bool bool_val;
double f64_val;
Intern_String intern_val;
bool bool_val;
double f64_val;
Intern_String intern_val;
BigInt big_int_val;
Ast_Type *type_val;
Ast_Type *type_val;
};
};
};
@@ -614,11 +614,11 @@ meta.inline_value_fields()
Ast_Type *type;
Ast_Decl *resolved_decl;
union {
bool bool_val;
double f64_val;
Intern_String intern_val;
bool bool_val;
double f64_val;
Intern_String intern_val;
BigInt big_int_val;
Ast_Type *type_val;
Ast_Type *type_val;
};
};
};
@@ -636,63 +636,7 @@ struct Core_Message {
Core_Message_Kind kind;
String string;
Token *tokens[2];
int trace_line;
char *trace_file;
};
/*
Array<Token> core_lex_file(Allocator *allocator, char *filename);
Array<Token> core_lex_string(Allocator *allocator, char *string, size_t size);
Core_Context *core_create_context(Allocator *allocator);
Array<Token> core_lex_string(Core_Context *ctx, char *string, size_t size);
AST Modification API
AST Query API
Tree walk interpreter / Bytecode interpreter
C code generation backend
Control of compilation with many hooks
Ast tags
* Accessing and modifying the AST
* Using as a scripting language
* Tree walk interp or Bytecode
* Using as a compiler
* C code backend
* C++ code backend ?
* Hooking into raw strings to preprocess
* Hooking into tokens to preprocess
* Hooking into AST to manipulate
* Hooking into Parsing to add syntax sugar
* Hooking into Parsing and typechecking to add language features
* Hooking into typechecking to add for example builtin functions
* Creating a custom code generation backend
* Performing compilation passes multiple times to get some sort of effect
* Accessing the typechecked AST and modifying it then typechecking modifications ??
* Tagging syntax for creating language features
Possible use cases:
I want to use it as a scripting language for my game
It should be able to not leak memory while rerunning scripts contnously
It should allow me to constrain certain features (pointer arithmetic)
It should allow me to add possible functions
I want to use this as a code generation tool
I should be able to access and modify the AST
I should be able to access the tokens for pre processing
I should be able to add my own syntax
I should be albe to add my own features
I should be able to create or modify a code generating back end
Code generation
Making DSLs
*/