diff options
| author | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2025-12-21 22:03:34 +0100 |
|---|---|---|
| committer | Felix Perktold <Felix.Perktold@student.uibk.ac.at> | 2025-12-21 22:03:34 +0100 |
| commit | c7878cd824360c6bf8a8e987acfa6a31140e9d69 (patch) | |
| tree | b1b882d77df4a5571c38cf6aada7666890a6423b /main.c | |
| parent | 47debf8cc2197187a347b43a795120638b017d5f (diff) | |
add builtins, add pretty printing for lists, fix erroneous symbol x not found for forms (define, lambda ...) add check for head->type == VT_SYMBOL on forms (so a string cannot be misinterpreted as a form symbol), move is_integer from lisp.y to lisp.h/lisp.c
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -12,6 +12,15 @@ env *global_env = NULL; int main(void) { // init global env global_env = env_create(NULL); + env_define(global_env, "cons", make_builtin(builtin_cons)); + env_define(global_env, "car", make_builtin(builtin_car)); + env_define(global_env, "cdr", make_builtin(builtin_cdr)); + env_define(global_env, "null?", make_builtin(builtin_isnull)); + env_define(global_env, "+", make_builtin(builtin_add)); + env_define(global_env, "-", make_builtin(builtin_sub)); + env_define(global_env, "*", make_builtin(builtin_mul)); + env_define(global_env, "/", make_builtin(builtin_div)); + env_define(global_env, "<=", make_builtin(builtin_le)); // START REPL char* line; while ((line = readline("λ > ")) != NULL) { |
