[slime-devel] broken clojure REPL

Helmut Eller heller at common-lisp.net
Sun Jan 10 08:15:37 UTC 2010


* Terje Norderhaug [2010-01-09 22:52+0100] writes:

> Now that there are multiple clients and servers, I think it is time  
> that we formalize the lisp syntax of the messages in the swank  
> protocol. It should be simple, limited to a subset of what is allowed  
> by Common Lisp... something parseable with say less than a page of  
> lisp code.

Here's a one page reader:

(defun simple-read ()
  (let ((c (read-char)))
    (case c
      (#\" (with-output-to-string (*standard-output*)
             (loop for c = (read-char) do
                   (case c
                     (#\" (return))
                     (#\\ (write-char (read-char)))
                     (t (write-char c))))))
      (#\( (loop collect (simple-read)
                 while (ecase (read-char) 
                         (#\) nil) 
                         (#\space t))))
      (#\' `(quote ,(simple-read)))
      (t (let ((string (with-output-to-string (*standard-output*)
                         (loop for ch = c then (read-char nil nil) do
                               (case ch
                                 ((nil)  (return))
                                 ((#\space #\)) (unread-char ch) (return))
                                 (t (write-char ch)))))))
           (cond ((digit-char-p (aref string 0)) (parse-integer string))
                 ((intern string))))))))

Now prove or disprove that Slime uses this syntax.

Helmut





More information about the slime-devel mailing list