fixed | and & ops, added a new dep (cl-fad util library)

This commit is contained in:
2024-08-01 00:08:18 +03:00
parent 56f71f43b2
commit 8713ffbd95
2 changed files with 13 additions and 13 deletions

View File

@@ -112,18 +112,17 @@
(with-gensyms (out-stream) (with-gensyms (out-stream)
(destructuring-bind (op-name . args) (mklist op-name+args) (destructuring-bind (op-name . args) (mklist op-name+args)
`(progn `(progn
,@(append ,@(unless (null lex)
(unless (null lex)
`((push ',op-name *identifiers*))) `((push ',op-name *identifiers*)))
`((setf (gethash ,(string op-name) *operations*) (setf (gethash ,(string op-name) *operations*)
(lambda (,out-stream ,@args) (lambda (,out-stream ,@args)
,@(mapcar #'(lambda (group) (expand-group group out-stream ,@(mapcar #'(lambda (group) (expand-group group out-stream
:indent indent)) :indent indent))
(group-by-syntax body)))))))))) (group-by-syntax body))))))))
;;; TODO: Turn stack operation comments to DEFOP option, ;;; TODO: Turn stack operation comments to DEFOP option,
;;; which then can be used by the user as a documentation ;;; which then can be used by the user as a documentation
;;; TODO: Better yet, generate the asm code directly from ;;; DONE: Better yet, generate the asm code directly from
;;; the stack op documentation (this seems easily doable) ;;; the stack op documentation (this seems easily doable)
;;; Hopefully these two are done, need testing... ;;; Hopefully these two are done, need testing...
@@ -193,10 +192,10 @@
(rbx rcx -- (:shr rbx cl))) (rbx rcx -- (:shr rbx cl)))
(defop "|" () (defop "|" ()
(rbx rcx -- (:or rbx cl))) (rbx rax -- (:or rbx rax)))
(defop & () (defop & ()
(rbx rcx -- (:and rbx cl))) (rbx rax -- (:and rbx rax)))
(defop dump () (defop dump ()
"pop rdi" "pop rdi"

View File

@@ -3,13 +3,14 @@
:version "0.1" :version "0.1"
:author "Emre Akan" :author "Emre Akan"
:licence "MIT" :licence "MIT"
:depends-on ("iterate") :depends-on ("iterate" "cl-fad")
:serial t :serial t
:components ((:file "package") :components ((:file "package")
(:file "util") (:file "util")
(:file "assembly") (:file "assembly")
(:file "cl-forth") (:file "cl-forth")
(:file "main")) (:file "main")
(:file "test/tests"))
:build-operation "program-op" :build-operation "program-op"
:build-pathname "test/cl-forth" :build-pathname "test/cl-forth"
:entry-point "cl-forth:main") :entry-point "cl-forth:main")