erpl.c 546 B

1234567891011121314151617181920212223
  1. #include "erpl.h"
  2. #include "erpli.c" // implementations
  3. #include "erple.c" // expressions evaluation
  4. int main (int argc, char** argv) {
  5. Atom *expr, *ret;
  6. Table *root_scope = NULL;
  7. while (!interrupted) {
  8. // TODO fix the "shell wannabe"
  9. printf("> ");
  10. expr = parse();
  11. ret = eval(expr,&root_scope);
  12. if (ret) {
  13. printf("returned: "); print_expression(ret); putchar(10);
  14. stack_push(ret, &stack);
  15. }
  16. free_atom(expr);
  17. if (ret != expr)
  18. free_atom(ret);
  19. }
  20. return 0;
  21. }