+#include "../config.h"
#include "../types.h"
#include "../builtins.h"
#include "../sexpr.h"
if(s->type == SYM) {
Sexpr* lookedup = lookup(dict, s);
if(lookedup->type == NIL) {
- printf("%s not defined\n", s->value.s);
+ //printf("%s not defined\n", s->value.s);
+ ERR("not defined: ", s->value.s);
sexpr_free(s);
return lookedup;
}
Sexpr* vals = vals_parse(tokens);
sexpr_free(tokens);
if(!balance_checker(vals)) {
- printf("unbalanced parenthesis\n");
+ WARN("unbalanced parenthesis", "");
sexpr_free(vals);
return NULL;
}
add_history(input);
Sexpr* in = parse(input);
if(in == NULL) {
- printf("bad input\n");
+ ERR("bad input\n", "");
}
else {
//printf("- -%s\n", sprint_sexpr(in));
Sexpr* out = eval(clone(in), env);
char* outstr = sprint_sexpr(out);
- printf(" - %s\n", outstr);
+ PRINTMV(" - ", outstr);
+ //printf(" - %s\n", outstr);
sexpr_free(in);
sexpr_free(out);
free(outstr);
char* sprint_sexpr(Sexpr* s) {
if(s == NULL) {
- printf("UH OH IT'S NULL\n");
+ WARN("UH OH IT'S NULL", "");
return NULL;
}
// assumes not null