guile-prescheme/TODO.org
2022-07-17 02:14:19 +10:00

2.3 KiB

Where next for guile-prescheme?

TODO guile repl integration

Currently the "prescheme" language definition is just scheme with a different default environment (aka. the "prelude", the stuff that's imported by default).

In the Guile REPL you can ,L prescheme to switch language, but it's not very useful because you stay in the guile-user module, which is Guile's default environment, not Pre-Scheme's!

You can create a Pre-Scheme module and switch into it with some effort:

(use-modules (system base language))
(set-module-name! (default-environment 'prescheme) '(prescheme-user))
,module prescheme-user
,language prescheme

We need to make the process of "give me a Pre-Scheme REPL" easier. Maybe just ship a REPL launcher script which starts up in Pre-Scheme instead of Guile?

TODO translate s48 macros to syntax-case

Scheme 48 uses "explicit renaming" macros, these should be ported to syntax-case.

;; scheme48-1.9.2/scheme/alt/define-macro-define-syntax.scm
(define-macro (define-syntax macro-name transformer . stuff)
  `(define-macro (,macro-name . args)
     (,transformer (cons ',macro-name args)
                   (lambda (x) x)
                   eq?)))

TODO prescheme/s48-defenum.scm

  • define-enumeration

TODO prescheme/ps-defenum.scm

  • define-external-enumeration

TODO prescheme/prescheme.scm

  • goto
  • external

TODO prepare some compatibility tests

We need to find collect all the "real-world" Pre-Scheme we can get our hands on, and test that our Guile Pre-Scheme produces identical output to Scheme 48 Pre-Scheme.

Exhibit A is the "hello world" from the manual:

;; https://thintz.com/resources/prescheme-documentation#Example-Pre_002dScheme-compiler-usage
(define (main argc argv)
  (if (= argc 2)
      (let ((out (current-output-port)))
        (write-string "Hello, world, " out)
        (write-string (vector-ref argv 1) out)
        (write-char #\! out)
        (newline out)
        0)
      (let ((out (current-error-port)))
        (write-string "Usage: " out)
        (write-string (vector-ref argv 0) out)
        (write-string " <user>" out)
        (newline out)
        (write-string "  Greets the world & <user>." out)
        (newline out)
        -1)))

TODO write more TODOs