We have a VERY SILL KRAKEN COMPILER\! simple_passthroughs are now emitted by the c_generator and test_compiler has been extended to write the C to a file and then call cc on it, so the self-hosted Kraken compiler can compile its very first thing\! (though that thing is a hello world C program written entirely in a simple_passthrough...
This commit is contained in:
@@ -8,6 +8,7 @@ import symbol:*
|
||||
import tree:*
|
||||
import serialize:*
|
||||
import c_generator:*
|
||||
import os:*
|
||||
|
||||
fun main():int {
|
||||
|
||||
@@ -79,9 +80,11 @@ fun main():int {
|
||||
var importer.construct(parse, ast_pass): importer
|
||||
importer.import(kraken_file_name)
|
||||
var c_generator.construct(): c_generator
|
||||
var c_output_pair = c_generator.generate(importer.name_ast_map)
|
||||
write_file(kraken_file_name + ".c", c_output_pair.first)
|
||||
var c_output_pair = c_generator.generate_c(importer.name_ast_map)
|
||||
var kraken_c_output_name = kraken_file_name + ".c"
|
||||
write_file(kraken_c_output_name, c_output_pair.first)
|
||||
println(string("linker string: ") + c_output_pair.second)
|
||||
system(string("cc -g -O3 -std=c99 ") + kraken_c_output_name + " -o " + kraken_file_name + ".exe")
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user