diff options
Diffstat (limited to 'src/core.c')
-rw-r--r-- | src/core.c | 21 |
1 files changed, 7 insertions, 14 deletions
@@ -3,6 +3,7 @@ #include <limits.h> #include <errno.h> +#include <posthaste/compile.h> #include <posthaste/execute.h> #include <posthaste/parser.h> #include <posthaste/debug.h> @@ -12,16 +13,6 @@ #include <posthaste/core.h> #include <posthaste/ast.h> -/** - * Read whole file into a buffer and return pointer to buffer. - * Possibly kind of silly to have both \p file and \p f. - * Apparently there's no standardized way to get the file name of a - * file pointer. - * - * @param fname Name of file to read. - * @param f File pointer. - * @return Pointer to buffer with file contents. - */ static char *read_file(const char *fname, FILE *f) { fseek(f, 0, SEEK_END); @@ -91,12 +82,14 @@ int run(const char *fname) goto out; } - if (lower_ast(ast)) { - ret = -1; - goto out; - } + lower_ast(ast); +#ifdef JIT + compile(ast); + execute_compilation(); +#else execute(); +#endif out: free((void *)buf); |