summaryrefslogtreecommitdiff
path: root/cl-forth.lisp
diff options
context:
space:
mode:
authormRnea <akannemre@gmail.com>2024-08-16 00:16:26 +0300
committermRnea <akannemre@gmail.com>2024-08-16 00:16:26 +0300
commit68947d00aa6666d6e4daed6a0f75009c9bf3048d (patch)
tree60dfb5968073d3bd9eaafb02f6327702dd02e5b6 /cl-forth.lisp
parent6eb5ad5b42c3f0bd134845659d3eeec71debfb21 (diff)
added file inclusion and optional macro documentation list
Diffstat (limited to 'cl-forth.lisp')
-rw-r--r--cl-forth.lisp14
1 files changed, 12 insertions, 2 deletions
diff --git a/cl-forth.lisp b/cl-forth.lisp
index bad08ef..410b112 100644
--- a/cl-forth.lisp
+++ b/cl-forth.lisp
@@ -3,7 +3,8 @@
(defun make-token (sym? line col &optional (type nil))
(when (null type)
(setf type
- (cond ((numberp sym?) :number)
+ (cond ((consp sym? ) :list)
+ ((numberp sym?) :number)
((stringp sym?) :string)
((is-identifier sym?) :identifier)
(t :unknown))))
@@ -183,7 +184,12 @@
(defmethod parse-op ((parser parser) token (type (eql :makro)))
;; makro name must be undefined before
(let ((makro-name-tok (read-token parser)))
- (assert (eq :unknown (getf (cdr makro-name-tok) :type)))
+ (assert (eq :unknown (getf (cdr makro-name-tok) :type)))
+ (let ((doc? (peek-token parser)))
+ (when (eq :list (getf (cdr doc?) :type))
+ (read-token parser)
+ ;; setf doc?
+ ))
(setf (gethash (car makro-name-tok) *makro-defs*)
(do ((tok (read-token parser)
(read-token parser))
@@ -197,6 +203,10 @@
(add-op (list :syscall syscall-num) parser)))
(t (add-op (list type) parser))))
+(defmethod parse-op ((parser parser) token (type (eql :kütüphane)))
+ (let ((file (car (read-token parser))))
+ (setf (tokens parser) (append (lex-file file) (tokens parser)))))
+
(defun parse-tokens (tokens)
(let ((parser (make-parser tokens)))
(iter (while (not (null (tokens parser))))