6 #include <readline/readline.h>
7 #include <readline/history.h>
9 #include <editline/readline.h>
12 char *READ(char prompt
[]) {
14 line
= readline(prompt
);
15 if (!line
) return NULL
; // EOF
16 add_history(line
); // Add input to history.
20 char *EVAL(char *ast
, void *env
) {
24 char *PRINT(char *exp
) {
33 // Set the initial prompt
34 snprintf(prompt
, sizeof(prompt
), "user> ");
39 exp
= EVAL(ast
, NULL
);
40 g_print("%s\n", PRINT(exp
));
42 free(ast
); // Free input string