From: Tim Vaughan Date: Tue, 12 Jul 2016 12:05:46 +0000 (+1200) Subject: Started adding support for pre-defined symbols. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=scheme.forth.jl.git;a=commitdiff_plain;h=2e9cddd4159c405bf8ff853060a87082ce44c7da Started adding support for pre-defined symbols. --- diff --git a/scheme.4th b/scheme.4th index 5ea44ee..120edd2 100644 --- a/scheme.4th +++ b/scheme.4th @@ -18,7 +18,7 @@ include defer-is.4th \ ------ Memory ------ -100 constant N +1000 constant N create car-cells N allot create car-type-cells N allot create cdr-cells N allot @@ -65,6 +65,33 @@ variable nextfree objvar symbol-table nil symbol-table setobj +\ ---- Pre-defined symbols ---- + +: (create-symbol) ( addr n -- symbol-obj ) + dup 0= if + 2drop nil + else + 2dup drop @ character-type 2swap + swap 1+ swap 1- + recurse + + cons + then +; + +: create-symbol ( -- ) + bl word + count + (create-symbol) + drop symbol-type + + symbol-table fetchobj + cons + symbol-table setobj +; + +create-symbol quote + \ ---- Read ---- variable parse-idx