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:
Nathan Braswell
2016-01-04 02:00:06 -05:00
parent 84032eece0
commit 79065c032f
6 changed files with 186 additions and 6 deletions

View File

@@ -80,6 +80,8 @@ obj ast_transformation (Object) {
return transform_if_comp(node, scope)
} else if (name == "simple_passthrough") {
return transform_simple_passthrough(node, scope)
} else if (name == "statement") {
return transform_statement(node, scope)
}
print("FAILED TO TRANSFORM: "); println(concat_symbol_tree(node))
return null<ast_node>()
@@ -107,7 +109,7 @@ obj ast_transformation (Object) {
fun transform_simple_passthrough(node: *tree<symbol>, scope: *ast_node): *ast_node {
var new_passthrough = ast_simple_passthrough_ptr()
// setup passthrough params and string
new_passthrough->simple_passthrough.passthrough_str = concat_symbol_tree(get_node("triple_quoted_string", node))
new_passthrough->simple_passthrough.passthrough_str = concat_symbol_tree(get_node("triple_quoted_string", node)).slice(3,-4)
return new_passthrough
}
fun transform_statement(node: *tree<symbol>, scope: *ast_node): *ast_node {