diff options
-rwxr-xr-x | build.sh | 6 | ||||
-rw-r--r-- | cl-forth.lisp | 2 | ||||
-rw-r--r-- | codegen.lisp (renamed from assembly.lisp) | 2 | ||||
-rw-r--r-- | errors.lisp | 26 | ||||
-rw-r--r-- | kurt.asd (renamed from cl-forth.asd) | 9 | ||||
-rw-r--r-- | main.lisp | 6 | ||||
-rw-r--r-- | package.lisp | 2 | ||||
-rw-r--r-- | simulation.lisp | 2 | ||||
-rw-r--r-- | test/arith.kurt (renamed from test/arith.lorth) | 0 | ||||
-rw-r--r-- | test/bits.kurt (renamed from test/bits.lorth) | 0 | ||||
-rw-r--r-- | test/branchs.kurt (renamed from test/branchs.lorth) | 0 | ||||
-rw-r--r-- | test/include.kurt | 3 | ||||
-rw-r--r-- | test/loop.kurt (renamed from test/loop.lorth) | 0 | ||||
-rw-r--r-- | test/makro.kurt (renamed from test/makro.lorth) | 0 | ||||
-rw-r--r-- | test/stack.kurt (renamed from test/stack.lorth) | 0 | ||||
-rw-r--r-- | test/std.kurt | 4 | ||||
-rw-r--r-- | test/syscall.kurt (renamed from test/syscall.lorth) | 0 | ||||
-rw-r--r-- | test/tests.lisp | 4 | ||||
-rw-r--r-- | util.lisp | 4 |
19 files changed, 52 insertions, 18 deletions
@@ -1,6 +1,6 @@ #!/bin/sh -sbcl --load cl-forth.asd \ - --eval '(ql:quickload :cl-forth)' \ - --eval '(asdf:make :cl-forth)' \ +sbcl --load kurt.asd \ + --eval '(ql:quickload :kurt)' \ + --eval '(asdf:make :kurt)' \ --eval '(quit)' diff --git a/cl-forth.lisp b/cl-forth.lisp index 410b112..ab3af1a 100644 --- a/cl-forth.lisp +++ b/cl-forth.lisp @@ -1,4 +1,4 @@ -(in-package :cl-forth) +(in-package :kurt) (defun make-token (sym? line col &optional (type nil)) (when (null type) diff --git a/assembly.lisp b/codegen.lisp index 16183f7..1e8c364 100644 --- a/assembly.lisp +++ b/codegen.lisp @@ -1,4 +1,4 @@ -(in-package :cl-forth) +(in-package :kurt) (defparameter *psuedo-identifiers* '(syscall-1 syscall-2 syscall-3 syscall-4 syscall-5 syscall-6 makro son kütüphane) diff --git a/errors.lisp b/errors.lisp new file mode 100644 index 0000000..2f955ca --- /dev/null +++ b/errors.lisp @@ -0,0 +1,26 @@ +(in-package :kurt) + +(defun report-line (line-num line col? &optional (stream t)) + (format stream "~5a:~a~%" line-num line) + (iter (for i from 0 below (+ 6 (if (consp col?) + (getf (cdr col?) :col) ;; if token get col + col?))) + (write-char #\Space stream)) + (format stream "^~%")) + +(define-condition char-not-closed () + ((line :initarg :line :reader line) + (col :initarg :col :reader col) + (line-num :initarg :line-num :reader line-num)) + (:report (lambda (condition stream) + (format stream "Karakterin kapanış sembolü ' eksik.~%") + (report-line (line-num condition) (line condition) (col condition) stream)))) + +(defun handle-char-not-closed (line-num line token-or-col) + (make-condition 'char-not-closed :line-num line-num :line line :col token-or-col)) + +;; (define-condition op-not-implemented (style-warning) +;; ((undef-ops :initarg :ops :reader undef-ops)) +;; (:report (lambda (condition stream) +;; (format stream "These ops are not defined in op-case: ~s" +;; (undef-ops condition))))) @@ -1,4 +1,4 @@ -(asdf:defsystem "cl-forth" +(asdf:defsystem "kurt" :description "Stack based language implemented in Common Lisp" :version "0.1" :author "Emre Akan" @@ -7,11 +7,12 @@ :serial t :components ((:file "package") (:file "util") - (:file "assembly") + (:file "errors") + (:file "codegen") (:file "cl-forth") (:file "simulation") (:file "main") (:file "test/tests")) :build-operation "program-op" - :build-pathname "test/cl-forth" - :entry-point "cl-forth:main") + :build-pathname "test/kurt" + :entry-point "kurt:main") @@ -1,4 +1,4 @@ -(in-package :cl-forth) +(in-package :kurt) ;; (defun main () ;; (let ((args (rest sb-ext:*posix-argv*))) @@ -97,8 +97,8 @@ (defun top-level-command () (clingon:make-command - :name "cl-forth" - :description "cl-forth derleyicisi" + :name "kurt" + :description "kurt derleyicisi" :version "0.1.0" :authors '("Emre Akan <akannemre@gmail.com>") :options (top-level-options) diff --git a/package.lisp b/package.lisp index 76547a0..3880c56 100644 --- a/package.lisp +++ b/package.lisp @@ -1,3 +1,3 @@ -(defpackage cl-forth +(defpackage kurt (:use :common-lisp :iterate) (:export #:main)) diff --git a/simulation.lisp b/simulation.lisp index 2699dc9..b0e317c 100644 --- a/simulation.lisp +++ b/simulation.lisp @@ -1,4 +1,4 @@ -(in-package :cl-forth) +(in-package :kurt) (defvar *stack* nil) (defvar *bel* nil) diff --git a/test/arith.lorth b/test/arith.kurt index 76bef42..76bef42 100644 --- a/test/arith.lorth +++ b/test/arith.kurt diff --git a/test/bits.lorth b/test/bits.kurt index 77be5b0..77be5b0 100644 --- a/test/bits.lorth +++ b/test/bits.kurt diff --git a/test/branchs.lorth b/test/branchs.kurt index 41eaf96..41eaf96 100644 --- a/test/branchs.lorth +++ b/test/branchs.kurt diff --git a/test/include.kurt b/test/include.kurt new file mode 100644 index 0000000..80b69d2 --- /dev/null +++ b/test/include.kurt @@ -0,0 +1,3 @@ +kütüphane "std.lorth" + +stdout "Merhaba Dünya!\n" write
\ No newline at end of file diff --git a/test/loop.lorth b/test/loop.kurt index 8234010..8234010 100644 --- a/test/loop.lorth +++ b/test/loop.kurt diff --git a/test/makro.lorth b/test/makro.kurt index 405f98b..405f98b 100644 --- a/test/makro.lorth +++ b/test/makro.kurt diff --git a/test/stack.lorth b/test/stack.kurt index 318d9be..318d9be 100644 --- a/test/stack.lorth +++ b/test/stack.kurt diff --git a/test/std.kurt b/test/std.kurt new file mode 100644 index 0000000..cf7e684 --- /dev/null +++ b/test/std.kurt @@ -0,0 +1,4 @@ +makro sys-write 1 son +makro write (fd string -- ) + değiş sys-write syscall-3 son +makro stdout 1 son
\ No newline at end of file diff --git a/test/syscall.lorth b/test/syscall.kurt index a58a9ec..a58a9ec 100644 --- a/test/syscall.lorth +++ b/test/syscall.kurt diff --git a/test/tests.lisp b/test/tests.lisp index 8b00817..0907a58 100644 --- a/test/tests.lisp +++ b/test/tests.lisp @@ -1,4 +1,4 @@ -(in-package :cl-forth) +(in-package :kurt) (defun drop-file-type (file &key (returns :string)) (let* ((file-str (namestring file)) @@ -73,7 +73,7 @@ (ignore-errors (run-test file :target target)))) (remove-if-not (lambda (file) - (string= "lorth" (pathname-type file))) + (string= "kurt" (pathname-type file))) (cl-fad:list-directory (from-root "test")))) counting (eq t success?) into succs @@ -1,4 +1,4 @@ -(in-package :cl-forth) +(in-package :kurt) (eval-when (:compile-toplevel :load-toplevel :execute) (defmacro eval-always (&body body) @@ -26,7 +26,7 @@ (apply #'uiop:run-program args options)) (defun from-root (path) - (merge-pathnames path (asdf:system-source-directory :cl-forth))) + (merge-pathnames path (asdf:system-source-directory :kurt))) ;; ,(file-namestring ;; (make-pathname :name (pathname-name path) |