From 78b7eb0e1b03557d9a19451944c8cca006e1652e Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Tue, 17 Sep 2024 10:04:27 +0200 Subject: [PATCH] forge/sf: const and var working --- forge/sf.lisp | 8 +++----- test/test-sf.lisp | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/forge/sf.lisp b/forge/sf.lisp index 3165974..158820c 100644 --- a/forge/sf.lisp +++ b/forge/sf.lisp @@ -148,8 +148,8 @@ #:? #:?? #:ptr #:get #:put #:in #:next - #:call #:call-if #:call-while #:comp - #: #:val)) + #:call #:call-if #:call-while #:val + #:)) (in-package :sf-builtin) @@ -188,7 +188,7 @@ (f:reg 'call #'(lambda () (f:call (popd)))) (f:reg 'call-if #'call-if) (f:reg 'call-while #'call-while) -(f:reg 'comp #'(lambda () (f:comp-item (popd)))) +(f:reg 'val #'(lambda () (f:pushd (list #'f:next (f:popd))))) (f:reg ' #'(lambda () (iter:stop f:*input*)) 'f:comp-word) -(f:reg 'val #'(lambda () (f:pushd (list #'f:next (f:popd))))) - ;;;; forge-code word definitions diff --git a/test/test-sf.lisp b/test/test-sf.lisp index 760b332..6229112 100644 --- a/test/test-sf.lisp +++ b/test/test-sf.lisp @@ -18,7 +18,8 @@ (progn ;(forge:setup-builtins) (test-exec) - (test-def))) + (test-def) + (test-val))) (util:lgi (forge:stack forge:*forge-env*)) (t:show-result))) @@ -39,4 +40,16 @@ (== (forge:popd) 27)) (deftest test-val () - (forge:exec-list '())) + (forge:exec-list '()) + (forge:exec-list '(7 const seven)) + (forge:exec-list '(seven square)) + (== (forge:popd) 49) + (forge:exec-list '()) + (forge:exec-list '(3 var myvar)) + (forge:exec-list '(myvar get)) + (== (forge:popd) 3) + (forge:exec-list '(42 myvar put)) + (forge:exec-list '(myvar get)) + (== (forge:popd) 42) + ) +