summaryrefslogtreecommitdiff
path: root/cl-forth.lisp
diff options
context:
space:
mode:
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))))