Compiling again, with double import, main and everything
This commit is contained in:
12
main.cpp
12
main.cpp
@@ -154,7 +154,6 @@ int main(int argument_count, char **arguments){
|
||||
|
||||
|
||||
#if 0
|
||||
emit_line_directives = true;
|
||||
if(argument_count > 1){
|
||||
Scratch scratch;
|
||||
String name = string_fmt(scratch, "%s.kl", arguments[1]);
|
||||
@@ -165,10 +164,10 @@ int main(int argument_count, char **arguments){
|
||||
Array<String> files = {scratch};
|
||||
files.add(name);
|
||||
String result = compile_files(files);
|
||||
FILE *f = fopen((const char *)c_filename.str, "w");
|
||||
|
||||
assert(f);
|
||||
fprintf(f, "%.*s", (int)result.len, result.str);
|
||||
fclose(f);
|
||||
|
||||
|
||||
F64 begin = os_time();
|
||||
system((const char *)compiler_call.str);
|
||||
printf("\nCompile time: %f", os_time() - begin);
|
||||
@@ -176,14 +175,15 @@ int main(int argument_count, char **arguments){
|
||||
system((const char *)run_program.str);
|
||||
}
|
||||
#else
|
||||
emit_line_directives = false;
|
||||
F64 total_time = os_time();
|
||||
begin_compilation();
|
||||
Ast_Module *module = add_module(pctx->intern("base.kl"_s));
|
||||
Ast_Module *module = add_module(pctx->intern("main.kl"_s));
|
||||
parse_all_modules();
|
||||
assert(module);
|
||||
resolve_everything_in_module(module);
|
||||
String result = end_compilation();
|
||||
printf("%s", result.str);
|
||||
assert(os_write_file("program.c"_s, result));
|
||||
printf("\nTotal time = %f", os_time() - total_time);
|
||||
printf("\nTotal parsing = %f", parsing_time_end - parsing_time_begin);
|
||||
printf("\nTotal resolving = %f", resolving_time_end - resolving_time_begin);
|
||||
|
||||
Reference in New Issue
Block a user