aboutsummaryrefslogtreecommitdiff
path: root/compiler/main.cup
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/main.cup')
-rw-r--r--compiler/main.cup11
1 files changed, 1 insertions, 10 deletions
diff --git a/compiler/main.cup b/compiler/main.cup
index 6d7c3d8..fa7db31 100644
--- a/compiler/main.cup
+++ b/compiler/main.cup
@@ -9,16 +9,7 @@ fn main(argc: int, argv: char **): int {
if (argc != 2)
die("Usage: cupcc <input_file>");
- let input_file = fopen(argv[1], 'r');
- defer fclose(input_file);
-
- // using `fmap` here doesn't work on linux, for some reason.
- let file_size = fsize(input_file);
- let src: char* = malloc(file_size+1);
- fread(input_file, src, file_size);
- src[file_size] = '\0';
-
- let lexer = lexer_new(argv[1], src, file_size);
+ let lexer = lexer_new_open_file(argv[1]);
let ast = parse_program(lexer);
dump_ast(ast, 0);