diff --git a/CHANGELOG.org b/CHANGELOG.org index 3290576..a1de68d 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -20,6 +20,7 @@ Added HACKING guide covering critical sections Added rom building steps to make Added more advanced cleaning options to makefile Extended stage2 lisp with null? +Extended stage2 lisp with string=? ** Changed Cleaned up x86 notes and moved into x86 folder @@ -30,6 +31,7 @@ Fixed failure to lookup symbols that are identical but are in different lexical Updated Bootstrapping instructions to reflect new checksum and recommendation for most minimal requirements Fixed flaws in existing makefile Added build instructions to README and listed dependencies +Imported High level prototypes for new functions ** Removed Purged notes that no longer apply or belong outside of stage0 diff --git a/bootstrapping Steps.org b/bootstrapping Steps.org index 75ef293..e70fa8f 100644 --- a/bootstrapping Steps.org +++ b/bootstrapping Steps.org @@ -152,7 +152,7 @@ Then we use our M0 Line macro assembler to convert our assembly into hex2 format Then we need to assemble that hex into our desired program: ./bin/vm --rom roms/stage1_assembler-2 --tape_01 temp2 --tape_02 roms/lisp --memory 48K -roms/lisp should have the sha256sum of 3b09ddadc89f5afb9b6c73f1deb488d592500c3799f84b81d3976545b0d9ff46 +roms/lisp should have the sha256sum of 4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a Our lisp will first attempt to evaluate any code in tape_01 and then evaluate any code that the user types in. It is recommended to run with no less than 4MB of Memory diff --git a/stage2/High_level_prototypes/lisp_eval.c b/stage2/High_level_prototypes/lisp_eval.c index 18ece78..347663c 100644 --- a/stage2/High_level_prototypes/lisp_eval.c +++ b/stage2/High_level_prototypes/lisp_eval.c @@ -205,6 +205,12 @@ struct cell* process_cons(struct cell* exp, struct cell* env) /*** Primitives ***/ +struct cell* nullp(struct cell* args) +{ + if(nil == args->car) return tee; + return nil; +} + struct cell* make_int(int a); struct cell* prim_sum(struct cell* args) { @@ -411,6 +417,21 @@ struct cell* prim_output(struct cell* args, FILE* out) return tee; } +struct cell* prim_stringeq(struct cell* args) +{ + if(nil == args) return nil; + + char* temp = args->car->string; + for(args = args->cdr; nil != args; args = args->cdr) + { + if(strcmp(temp, args->car->string)) + { + return nil; + } + } + return tee; +} + struct cell* prim_display(struct cell* args) { return prim_output(args, stdout); @@ -495,6 +516,7 @@ void init_sl3() spinup(s_let, s_let); /* Add Primitive Specials */ + spinup(make_sym("null?"), make_prim(nullp)); spinup(make_sym("+"), make_prim(prim_sum)); spinup(make_sym("-"), make_prim(prim_sub)); spinup(make_sym("*"), make_prim(prim_prod)); @@ -514,6 +536,7 @@ void init_sl3() spinup(make_sym("ascii!"), make_prim(prim_ascii)); spinup(make_sym("list?"), make_prim(prim_listp)); spinup(make_sym("list"), make_prim(prim_list)); + spinup(make_sym("string=?"), make_prim(prim_stringeq)); spinup(make_sym("cons"), make_prim(prim_cons)); spinup(make_sym("car"), make_prim(prim_car)); spinup(make_sym("cdr"), make_prim(prim_cdr)); diff --git a/test/SHA256SUMS b/test/SHA256SUMS index b39a3fb..545ba72 100644 --- a/test/SHA256SUMS +++ b/test/SHA256SUMS @@ -1,6 +1,6 @@ 8f465d3ec1cba00a7d024a1964e74bb6d241f86a73c77d95d8ceb10d09c8f7b9 roms/CAT 0aacf6258e9de0acde755229ad14e6ce13ab7a43b0360dadeb862f8facccc422 roms/forth -3b09ddadc89f5afb9b6c73f1deb488d592500c3799f84b81d3976545b0d9ff46 roms/lisp +4c146297da8c672955698a82207295b28feb389c9856a2c6ea6a60ce7e84260a roms/lisp 2b9727381aec15a504c0898189fbc2344209d8e04451e3fa5d743e08e38f64cf roms/M0 24a4d74eb2eb7a82e68335643855658b27b5a6c3b13db473539f3e08d6f26ceb roms/SET 0a427b14020354d1c785f5f900677e0059fce8f8d4456e9c19e5528cb17101eb roms/stage0_monitor