Regex rewrite for big speed gain, some extras (--no-c-compile), -O2 is default now

This commit is contained in:
Nathan Braswell
2016-08-02 01:33:16 -07:00
parent 523526f40e
commit b0d2a6918d
3 changed files with 101 additions and 58 deletions

View File

@@ -45,8 +45,9 @@ fun main(argc: int, argv: **char):int {
}
var input_file_offset = 1
var interpret_instead = false
var opt_str = string("-O3")
var opt_str = string("-O2")
var line_ctrl = false
var compile_c = true
var positional_args = vector<string>()
var flags = set<string>()
for (var i = 1; i < argc; i++;) {
@@ -57,6 +58,8 @@ fun main(argc: int, argv: **char):int {
opt_str = arg_str
} else if (arg_str == "-g") {
line_ctrl = true
} else if (arg_str == "--no-c-compile") {
compile_c = false
} else if (arg_str.length() > 2 && arg_str.first() == '-') {
flags.add(arg_str.slice(1,-1))
} else {
@@ -164,9 +167,11 @@ fun main(argc: int, argv: **char):int {
var c_output_pair = c_generator.generate_c(importer.name_ast_map, importer.ast_pass.ast_to_syntax)
var kraken_c_output_name = kraken_file_name + ".c"
write_file(kraken_c_output_name, c_output_pair.first)
var compile_string = "cc -g " + opt_str + " -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -std=c99 " + c_output_pair.second + " " + kraken_c_output_name + " -o " + executable_name
printlnerr(compile_string)
system(compile_string)
if (compile_c) {
var compile_string = "cc -g " + opt_str + " -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -std=c99 " + c_output_pair.second + " " + kraken_c_output_name + " -o " + executable_name
printlnerr(compile_string)
system(compile_string)
}
}
return 0