basic One2C code gen
This commit is contained in:
14
main.v
14
main.v
@@ -1,9 +1,10 @@
|
||||
module main
|
||||
|
||||
import os
|
||||
import strings
|
||||
|
||||
fn main() {
|
||||
content := os.read_file("test.one") or { return }
|
||||
content := os.read_file("source.one") or { return }
|
||||
println("---------\n" + content + "---------")
|
||||
tokens := lex(content) or { return }
|
||||
println("-- TOK --")
|
||||
@@ -17,4 +18,15 @@ fn main() {
|
||||
|
||||
println("-- AST --")
|
||||
println(statements)
|
||||
|
||||
mut generator := Generator{
|
||||
out: strings.new_builder(100)
|
||||
}
|
||||
|
||||
out_c := generator.gen_c(statements)
|
||||
|
||||
println("--- C ---")
|
||||
println(out_c)
|
||||
compile_with_clang(out_c, 'test', true)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user