11 MalVal
*READ(char prompt
[], char *str
) {
17 line
= _readline(prompt
);
24 if (!str
) { MAL_GC_FREE(line
); }
29 MalVal
*EVAL(MalVal
*ast
, GHashTable
*env
) {
30 if (!ast
|| mal_error
) return NULL
;
35 char *PRINT(MalVal
*exp
) {
39 return _pr_str(exp
,1);
45 MalVal
*RE(GHashTable
*env
, char *prompt
, char *str
) {
47 ast
= READ(prompt
, str
);
48 if (!ast
|| mal_error
) return NULL
;
51 malval_free(ast
); // Free input structure
64 // Set the initial prompt
65 snprintf(prompt
, sizeof(prompt
), "user> ");
69 exp
= RE(NULL
, prompt
, NULL
);
70 if (mal_error
&& strcmp("EOF", mal_error
->val
.string
) == 0) {
76 fprintf(stderr
, "Error: %s\n", _pr_str(mal_error
,1));
77 malval_free(mal_error
);
81 MAL_GC_FREE(output
); // Free output string
84 //malval_free(exp); // Free evaluated expression