swissChili | f3e7f18 | 2021-04-20 13:57:22 -0700 | [diff] [blame] | 1 | #include "compiler.h" |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 2 | #include "lisp.h" |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 3 | |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 4 | int main(int argc, char **argv) |
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 5 | { |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 6 | if (argc < 2) |
swissChili | bed8092 | 2021-04-13 21:58:05 -0700 | [diff] [blame] | 7 | { |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 8 | puts("pass the string you want to parse as the first argument please"); |
swissChili | bed8092 | 2021-04-13 21:58:05 -0700 | [diff] [blame] | 9 | return 1; |
10 | } | ||||
11 | |||||
swissChili | 923b536 | 2021-05-09 20:31:43 -0700 | [diff] [blame] | 12 | struct istream *is = new_fistream(argv[1], false); |
13 | |||||
14 | if (is == NULL) | ||||
15 | { | ||||
16 | fprintf(stderr, "Could not open %s\n", argv[1]); | ||||
17 | return 1; | ||||
18 | } | ||||
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 19 | |
swissChili | 3ec55cf | 2021-05-28 08:23:23 -0700 | [diff] [blame] | 20 | <<<<<<< HEAD |
swissChili | 53472e8 | 2021-05-08 16:06:32 -0700 | [diff] [blame] | 21 | struct environment env = compile_all(is); |
22 | value_t (*lisp_main)() = find_function(&env, "main")->def0; | ||||
23 | lisp_main(); | ||||
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 24 | |
swissChili | 923b536 | 2021-05-09 20:31:43 -0700 | [diff] [blame] | 25 | del_fistream(is); |
swissChili | 3ec55cf | 2021-05-28 08:23:23 -0700 | [diff] [blame] | 26 | ======= |
27 | struct environment env = compile_all (is); | ||||
28 | value_t (*lisp_main) () = find_function(&env, "main")->def0; | ||||
29 | lisp_main (); | ||||
30 | >>>>>>> 6afa62d (Remove free) | ||||
swissChili | 7a6f5eb | 2021-04-13 16:46:02 -0700 | [diff] [blame] | 31 | } |