About

Graduate student at the Georgia Institute of Technology, School of Physics. I am phm on #chicken in libera.chat.

I like programming languages that are simple, standard, and with a few core ideas that can be widely leveraged. This includes C, Standard ML, and (of course) Scheme.

For more information see my website.

I contributed to the implementations of the complex inverse trigonometric functions in CHICKEN.

Eggs

Maintainer

Author

SRFI 267

This SRFI can be implemented as a reader extension to CHICKEN.

(define (read-raw-string port)
  ;; This parser starts reading after `"`.
  ;; In the given examples, the parser starts at the dot:
  ;;
  ;; #"."asdf""
  ;; #".--"#"()""--"
  (define (read-char* location)
    (let ((ch (read-char port)))
      (if (eof-object? ch)
          (error (list "eof in raw string literal" location))
          ch)))
  (define delimiter
    (do ((ch (read-char* 'delim) (read-char* 'delim))
         (acc '(#\") (cons ch acc)))
        ((char=? ch #\")
         (reverse (cons #\" acc)))))
  (call-with-port (open-output-string)
    (lambda (out)
      (define (read-delimiter n rest-of-delimiter)
        (if (null? rest-of-delimiter)
            (get-output-string out)
            (let ((ch (read-char* 'check)))
              (if (char=? ch (car rest-of-delimiter))
                  (read-delimiter (+ n 1) (cdr rest-of-delimiter))
                  (do ((n n (- n 1))
                       (delimiter delimiter (cdr delimiter)))
                      ((zero? n) (read-raw ch))
                    (write-char (car delimiter) out))))))
      (define (read-raw ch)
        (if (char=? ch (car delimiter))
            (read-delimiter 1 (cdr delimiter))
            (begin (write-char ch out)
                   (read-raw (read-char* 'read)))))
      (read-raw (read-char* 'read)))))

(import (chicken read-syntax))
(set-sharp-read-syntax! #\" read-raw-string))

Misc