forge/sf: steps towards compiling, + minor improvements
This commit is contained in:
parent
2c9dbfde3e
commit
18bfcd8224
3 changed files with 12 additions and 7 deletions
|
@ -21,7 +21,7 @@
|
|||
(:method ((it t))
|
||||
(pushd it))
|
||||
(:method ((it symbol))
|
||||
(funcall (func (symbol-value it)))))
|
||||
(call-item (symbol-value it))))
|
||||
|
||||
(defgeneric comp-item (it))
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
|||
(defclass word ()
|
||||
((func :reader func :initarg :func)))
|
||||
|
||||
(defmethod call-item ((it word))
|
||||
(funcall (func it)))
|
||||
(defmethod call-item ((w word))
|
||||
(funcall (func w)))
|
||||
|
||||
(defclass comp-word (word) ())
|
||||
|
||||
|
@ -62,12 +62,15 @@
|
|||
|
||||
(defpackage :sf-builtin
|
||||
(:use :common-lisp)
|
||||
(:local-nicknames (:f :scopes/forge/sf))
|
||||
(:export #:add #:mul #:dup))
|
||||
(:local-nicknames (:f :scopes/forge/sf)
|
||||
(:iter :scopes/util/iter))
|
||||
(:export #:add #:mul #:dup #:in #:?))
|
||||
|
||||
(in-package :sf-builtin)
|
||||
|
||||
(f:reg2 'add #'+)
|
||||
(f:reg2 'mul #'*)
|
||||
|
||||
(f:reg 'dup #'(lambda () (pushd (peekd))))
|
||||
(f:reg 'dup #'(lambda () (f:pushd (f:peekd))))
|
||||
|
||||
(f:reg 'in #'(lambda () (f:pushd (iter:next-value f:*input*))))
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
(forge:exec-list '(4 2 add))
|
||||
(util:lgi forge:*stack*)
|
||||
(== (forge:popd) 6)
|
||||
(forge:exec-list '(in name))
|
||||
(util:lgi (forge:popd))
|
||||
(t:show-result))
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
(defpackage :scopes/util/iter
|
||||
(:use :common-lisp)
|
||||
(:export #:next #:value #:process
|
||||
(:export #:next #:value #:next-value #:process
|
||||
#:list-iterator))
|
||||
|
||||
(in-package :scopes/util/iter)
|
||||
|
|
Loading…
Add table
Reference in a new issue