aboutsummaryrefslogtreecommitdiff
path: root/forth/reader.fs
diff options
context:
space:
mode:
authorChouser <chouser@n01se.net>2015-02-16 21:28:05 -0500
committerChouser <chouser@n01se.net>2015-02-21 13:22:44 -0500
commit794bfca1361fc6900f0ea0186d64111c3a02b0f8 (patch)
tree49fe97a5eef0c3bd54d0d7735261348794259873 /forth/reader.fs
parentbf6a574e00a221dfe564ba11148deaa73ba8a229 (diff)
downloadmal-794bfca1361fc6900f0ea0186d64111c3a02b0f8.tar.gz
mal-794bfca1361fc6900f0ea0186d64111c3a02b0f8.zip
forth: Add step 7
Diffstat (limited to 'forth/reader.fs')
-rw-r--r--forth/reader.fs18
1 files changed, 12 insertions, 6 deletions
diff --git a/forth/reader.fs b/forth/reader.fs
index 6547a79..1daa650 100644
--- a/forth/reader.fs
+++ b/forth/reader.fs
@@ -98,9 +98,15 @@ defer read-form ( str-addr str-len -- str-addr str-len mal-obj )
drop adv-str
old-here here>MalList ;
+s" deref" MalSymbol. constant deref-sym
+s" quote" MalSymbol. constant quote-sym
+s" quasiquote" MalSymbol. constant quasiquote-sym
+s" splice-unquote" MalSymbol. constant splice-unquote-sym
+s" unquote" MalSymbol. constant unquote-sym
+
: read-wrapped ( buf-addr buf-len quote-char sym-addr sym-len -- buf-addr buf-len char mal-list )
here { old-here }
- MalSymbol. , ( buf-addr buf-len char )
+ , ( buf-addr buf-len char )
read-form , ( buf-addr buf-len char )
old-here here>MalList ;
@@ -112,13 +118,13 @@ defer read-form ( str-addr str-len -- str-addr str-len mal-obj )
dup [char] { = if [char] } read-list MalMap new tuck MalMap/list ! else
dup [char] " = if read-string-literal else
dup [char] : = if drop adv-str read-symbol-str MalKeyword. else
- dup [char] @ = if drop adv-str s" deref" read-wrapped else
- dup [char] ' = if drop adv-str s" quote" read-wrapped else
- dup [char] ` = if drop adv-str s" quasiquote" read-wrapped else
+ dup [char] @ = if drop adv-str deref-sym read-wrapped else
+ dup [char] ' = if drop adv-str quote-sym read-wrapped else
+ dup [char] ` = if drop adv-str quasiquote-sym read-wrapped else
dup [char] ~ = if
drop adv-str
- dup [char] @ = if drop adv-str s" splice-unquote" read-wrapped
- else s" unquote" read-wrapped
+ dup [char] @ = if drop adv-str splice-unquote-sym read-wrapped
+ else unquote-sym read-wrapped
endif
else
dup [char] ^ = if