blob: 8a50a5ee1c50eb51f65dd89c7277ac5f19e27b37 [file] [log] [blame]
swissChilif3e7f182021-04-20 13:57:22 -07001#include "compiler.h"
swissChili53472e82021-05-08 16:06:32 -07002#include "lisp.h"
swissChili7a6f5eb2021-04-13 16:46:02 -07003
swissChili53472e82021-05-08 16:06:32 -07004int main(int argc, char **argv)
swissChili7a6f5eb2021-04-13 16:46:02 -07005{
swissChili53472e82021-05-08 16:06:32 -07006 if (argc < 2)
swissChilibed80922021-04-13 21:58:05 -07007 {
swissChili53472e82021-05-08 16:06:32 -07008 puts("pass the string you want to parse as the first argument please");
swissChilibed80922021-04-13 21:58:05 -07009 return 1;
10 }
11
swissChili923b5362021-05-09 20:31:43 -070012 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 }
swissChili7a6f5eb2021-04-13 16:46:02 -070019
swissChili3ec55cf2021-05-28 08:23:23 -070020 struct environment env = compile_all (is);
21 value_t (*lisp_main) () = find_function(&env, "main")->def0;
22 lisp_main ();
swissChili7a6f5eb2021-04-13 16:46:02 -070023}