klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit feb11a307477cf0b4494702d4b329cda0561d6fa
parent 68df344a438f6bda12dc03e190708ad757b5ec8a
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 25 Nov 2011 00:38:40 -0300

Added TODO with remaining task to close r7rs branch. (More than I have thought sadly...)

Diffstat:
ATODO | 55+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/kerror.c | 2++
Msrc/kgchars.c | 1+
Msrc/kgerrors.c | 20+++++++++++++++++---
Msrc/kgstrings.c | 1+
5 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/TODO b/TODO @@ -0,0 +1,55 @@ +r7rs branch: + +* refactor: +** double check combiner names to be verbs + (e.g. add get- where appropriate) +* fix: +** current-jiffy +** jiffies-per-second +* operatives: +** $when +** $unless +** $string-for-each +** $vector-for-each +** $bytevector-for-each +** $case +** $case-lambda +** $case-vau +** $named-let +** $do +* applicatives: +** exact-integer? +** reverse +** make-list +** list-copy +** list-set! +** vector-map +** bytevector-map +** char-foldcase +** string-map +** string-downcase +** string-foldcase +** string-upcase +** vector->string +** string->vector +** vector-fill +** vector-copy! +** vector-copy-partial +** vector-copy-partial! +** read-line +** number->string +** string->number +** define-record-type +* reader +** symbol escapes +** string escapes +** char escapes +* other +** optional argument to member? +** optional argument to assoc +** some simplified error guarding +** restarts +** add restart support to the repl/interpreter +** simple modules (something inspired in r7rs) +** add modules support to the interpreter + diff --git a/src/kerror.c b/src/kerror.c @@ -106,6 +106,8 @@ void klispE_throw_simple(klisp_State *K, char *msg) /* GC: assumes all objs passed are rooted */ void klispE_throw_with_irritants(klisp_State *K, char *msg, TValue irritants) { + /* it's important that this is immutable, because it's user + accessible */ TValue error_msg = kstring_new_b_imm(K, msg); krooted_tvs_push(K, error_msg); TValue error_obj = diff --git a/src/kgchars.c b/src/kgchars.c @@ -76,6 +76,7 @@ void kinteger_to_char(klisp_State *K) kapply_cc(K, ch2tv((char) i)); } +/* REFACTOR merge with downcase and future foldcase */ /* 14.1.4? char-upcase, char-downcase */ void kchar_upcase(klisp_State *K) { diff --git a/src/kgerrors.c b/src/kgerrors.c @@ -57,6 +57,7 @@ void error_object_message(klisp_State *K) UNUSED(denv); bind_1tp(K, ptree, "error object", ttiserror, error_tv); Error *err_obj = tv2error(error_tv); + /* the string is immutable, no need to copy it */ klisp_assert(ttisstring(err_obj->msg)); kapply_cc(K, err_obj->msg); } @@ -102,11 +103,24 @@ void kinit_error_ground_env(klisp_State *K) TValue ground_env = K->ground_env; TValue symbol, value; - add_applicative(K, ground_env, "error-object?", typep, 2, symbol, i2tv(K_TERROR)); + add_applicative(K, ground_env, "error-object?", typep, 2, symbol, + i2tv(K_TERROR)); add_applicative(K, ground_env, "error", kgerror, 0); add_applicative(K, ground_env, "raise", kgraise, 0); - add_applicative(K, ground_env, "error-object-message", error_object_message, 0); - add_applicative(K, ground_env, "error-object-irritants", error_object_irritants, 0); + /* MAYBE add get- and remove object from these names */ + add_applicative(K, ground_env, "error-object-message", + error_object_message, 0); + add_applicative(K, ground_env, "error-object-irritants", + error_object_irritants, 0); + /* TODO raise-continuable from r7rs doesn't make sense in the Kernel + system of handling continuations. + What we could have is a more sofisticated system + of restarts, which would be added to an error object + and would encapsulate continuations and descriptions of them. + It would be accessible with + error-object-restarts or something like that. + See Common Lisp and mit scheme for examples + */ klisp_assert(ttiscontinuation(K->system_error_cont)); add_value(K, ground_env, "system-error-continuation", K->system_error_cont); diff --git a/src/kgstrings.c b/src/kgstrings.c @@ -537,6 +537,7 @@ void kinit_strings_ground_env(klisp_State *K) string_to_immutable_string, 0); /* TODO: add string-upcase and string-downcase like in r7rs-draft */ + /* foldcase too */ /* 13.2.10? string-fill! */ add_applicative(K, ground_env, "string-fill!", string_fillS, 0);