v/v2.v

33 lines
526 B
V
Raw Normal View History

module main
import (
v.parser
v.table
2019-12-30 08:30:24 +01:00
v.gen
os
)
const (
cdefs = '
#define true 1
#define false 0
2019-12-30 08:30:24 +01:00
typedef int bool;
typedef struct { char* str; } string;
typedef double f64;
string tos3(char* s) { return (string){ .str = s }; }
')
fn main() {
path := os.args[1]
println('V2 $path')
2020-01-02 08:30:15 +01:00
table := table.new_table()
program := parser.parse_file(path, table)
2019-12-30 17:05:32 +01:00
res := gen.cgen([program])
mut out := os.create('out.c')?
out.writeln(cdefs)
out.writeln(res)
out.close()
println('out.c generated')
os.system('cc out.c')
}