From e313d799b06ae53584ab57ea8dbc3846ba448e92 Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Tue, 13 Jul 2021 23:41:58 +0200 Subject: [PATCH 1/2] fix include order in forth.c --- forth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forth.c b/forth.c index 3da8507..8f34e81 100644 --- a/forth.c +++ b/forth.c @@ -3,8 +3,8 @@ // A simple Reference implementation // for the Raillisp Forth Specification. -#include #include +#include #include #include #include From 538221308a2c7e5a13aa59b73f9516f57d86810a Mon Sep 17 00:00:00 2001 From: Herwig Hochleitner Date: Tue, 13 Jul 2021 23:45:02 +0200 Subject: [PATCH 2/2] fix '-' symbols --- raillisp.fth | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/raillisp.fth b/raillisp.fth index d9dc436..717cd54 100644 --- a/raillisp.fth +++ b/raillisp.fth @@ -717,8 +717,21 @@ defer lisp-read-lisp r> drop ( drop tail) r> ( return first) then ; +: lisp-s>number? ( a u -- n o b ) + \ s>number?, except that - is not considered a number + dup 1 = if + drop dup c@ [char] - = if + drop 0 0 0 + else + 1 s>number? + then + else + s>number? + then +; + : lisp-read-symbol ( e a -- e a lisp ) - lisp-read-token 2dup s>number? if + lisp-read-token 2dup lisp-s>number? if drop tag-num nip nip else 2drop 2dup s" nil" compare 0= if @@ -1511,7 +1524,7 @@ s" command-line-args" str-intern sym>value _command-line-args ! r> -rot r> cmove ) 1 (defun str->int ( lisp - lisp ) - symbol->string s>number? if drop tag-num else nil then ) + symbol->string lisp-s>number? if drop tag-num else nil then ) 1 (defun make-empty-vec ( n - ) \ Contains uninitialized lisp objects. Should ever be printed.