summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assembly.lisp2
-rw-r--r--cl-forth.lisp14
2 files changed, 13 insertions, 3 deletions
diff --git a/assembly.lisp b/assembly.lisp
index fc5f58a..16183f7 100644
--- a/assembly.lisp
+++ b/assembly.lisp
@@ -1,7 +1,7 @@
(in-package :cl-forth)
(defparameter *psuedo-identifiers*
- '(syscall-1 syscall-2 syscall-3 syscall-4 syscall-5 syscall-6 makro son)
+ '(syscall-1 syscall-2 syscall-3 syscall-4 syscall-5 syscall-6 makro son kütüphane)
"These do not map to operations that generate code directly, but are valid to lexer and parser")
(defparameter *identifiers* ())
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))))