blob: b2c759020edaff4b203cfd653d2229585df70613 [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
swissChili53472e82021-05-08 16:06:32 -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
swissChili923b5362021-05-09 20:31:43 -070024 del_fistream(is);
swissChili7a6f5eb2021-04-13 16:46:02 -070025}