blob: fa7db31f1f85e4c6baf61e870ea7d5e2517d36c5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
import "std/file.cup"
// FIXME: The order of the following lines is important.
// Perhaps have multiple passes?
import "compiler/builtins.cup"
import "compiler/parser.cup"
import "compiler/codegen.cup"
fn main(argc: int, argv: char **): int {
if (argc != 2)
die("Usage: cupcc <input_file>");
let lexer = lexer_new_open_file(argv[1]);
let ast = parse_program(lexer);
dump_ast(ast, 0);
let out_file = fopen("build/host.nasm", 'w');
defer fclose(out_file);
generate_program(ast, out_file);
puts("---------------------------\n");
puts("Total amount of memory used by malloc: ");
putu(__malloc_buf_pos);
putsln("\nDone.");
}
|