Started adding support for pre-defined symbols.
authorTim Vaughan <tgvaughan@gmail.com>
Tue, 12 Jul 2016 12:05:46 +0000 (00:05 +1200)
committerTim Vaughan <tgvaughan@gmail.com>
Tue, 12 Jul 2016 12:05:46 +0000 (00:05 +1200)
scheme.4th

index 5ea44ee..120edd2 100644 (file)
@@ -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