Compiling and running first program!
This commit is contained in:
12
ccodegen.cpp
12
ccodegen.cpp
@@ -288,7 +288,6 @@ gen_ast(Ast *ast){
|
||||
if(sym->type->kind == TYPE_LAMBDA){
|
||||
if(node->value->kind == AST_LAMBDA){
|
||||
Ast_Lambda *lambda = (Ast_Lambda *)node->value;
|
||||
gen("static ");
|
||||
Ast_Resolved_Type *ret = resolved_type_get(lambda->ret);
|
||||
gen_simple_decl(ret, node->name);
|
||||
gen("(");
|
||||
@@ -316,7 +315,7 @@ gen_ast(Ast *ast){
|
||||
gen("// constant F64 %s = %f;", node->name.str, sym->f64_val);
|
||||
}
|
||||
else if(sym->type == untyped_int){
|
||||
gen("// constant Int %s = %lld;", node->name.str, sym->int_val);
|
||||
gen("// constant int %s = %lld;", node->name.str, sym->int_val);
|
||||
}
|
||||
else if(sym->type == untyped_string){
|
||||
gen("// const String %s = LIT(\"%s\");", node->name.str, sym->intern_val.str);
|
||||
@@ -405,7 +404,6 @@ compile_string(String filecontent, String filename = "default_name"_s){
|
||||
|
||||
|
||||
gen(R"==(
|
||||
|
||||
#include <stdint.h>
|
||||
typedef int8_t S8;
|
||||
typedef int16_t S16;
|
||||
@@ -420,15 +418,15 @@ typedef S16 B16;
|
||||
typedef S32 B32;
|
||||
typedef S64 B64;
|
||||
typedef U64 SizeU;
|
||||
typedef S64 SizeI;
|
||||
typedef S64 SizeS;
|
||||
typedef float F32;
|
||||
typedef double F64;
|
||||
|
||||
struct String{
|
||||
typedef struct String{
|
||||
U8 *str;
|
||||
S64 len;
|
||||
};
|
||||
|
||||
}String;
|
||||
#define LIT(x) (String){.str=(U8 *)x, .len=sizeof(x)-1}
|
||||
)==");
|
||||
|
||||
F64 resolve_begin = os_time();
|
||||
|
||||
Reference in New Issue
Block a user