ref_lower now generates C, though a ton of syntax errors

This commit is contained in:
Nathan Braswell
2017-01-20 01:11:06 -05:00
parent b0d2a6918d
commit e2639989c9
16 changed files with 345 additions and 56 deletions

View File

@@ -12,6 +12,7 @@ import ast_transformation:*
import adt_lower:*
import obj_lower:*
import defer_lower:*
import ref_lower:*
import ctce_lower:*
import c_line_control:*
import node_counter:*
@@ -34,12 +35,13 @@ fun main(argc: int, argv: **char):int {
file_contents = string("RealGoal = boolean_expression ;\n") + file_contents
doing_repl = true
} else if (string(argv[1]) == "-v" || string(argv[1]) == "--version") {
var version_c_string = #ctce(fun(): *char {
var version_string = string("Self-hosted Kraken compiler \"Kalypso\" - revision ") + from_system_command(string("git rev-list HEAD | wc -l"), 100) +
", commit: " + from_system_command(string("git rev-parse HEAD"), 100) +
", compile date: " + from_system_command(string("date"), 100)
return version_string.toCharArray()
}())
var version_c_string = "fail"
/*var version_c_string = #ctce(fun(): *char {*/
/*var version_string = string("Self-hosted Kraken compiler \"Kalypso\" - revision ") + from_system_command(string("git rev-list HEAD | wc -l"), 100) +*/
/*", commit: " + from_system_command(string("git rev-parse HEAD"), 100) +*/
/*", compile date: " + from_system_command(string("date"), 100) */
/*return version_string.toCharArray()*/
/*}())*/
println(version_c_string)
exit(0)
}
@@ -148,6 +150,10 @@ fun main(argc: int, argv: **char):int {
defer_lower(&importer.name_ast_map, &importer.ast_pass.ast_to_syntax)
/*printlnerr("Counting Nodes")*/
/*node_counter(&importer.name_ast_map, &importer.ast_pass.ast_to_syntax)*/
printlnerr("Lowering Ref")
ref_lower(&importer.name_ast_map, &importer.ast_pass.ast_to_syntax)
/*printlnerr("Counting Nodes")*/
/*node_counter(&importer.name_ast_map, &importer.ast_pass.ast_to_syntax)*/
// Lowers #ctce and the current #ctce_pass
printlnerr("Lowering CTCE")
ctce_lower(&importer.name_ast_map, &importer.ast_pass.ast_to_syntax)