R7RS to R6RS library converter design - higepon/mosh GitHub Wiki

include

R7RS expectations

(include 〈string1〉 〈string2〉 . . . ) syntax
(include-ci 〈string1〉 〈string2〉 . . . ) syntax

effectively re- place the include or include-ci expression with a begin expression containing what was read from the files.

How we do it in psyntax

  • psyntax
    • It has (include <string>). The behaviour matches R7RS.
  • We should rewrite (include s1 s2 ...) to multiple (include s).
  • We should support (include path) where path="x.scm" and x.scm is locating in the same directory as the including library.

file extension

Expectations

  • .sls for R6RS library (supported)
  • .sds for R7RS library + (include .scm R5RS library) (not supported)
  • .mosh.sds > .sds (not supported)
    • I think I saw this pattern but don't remember.

How we do it?

  • psyntax
    • Extensions: '(".sls" ".ss" ".scm") are supported as extension of a library file.
    • Add .sds here.
    • How do we treat .scm?
      • When psyntax sees (import (mosh test)), it searches mosh/test.sds, mosh/test.sls, mosh/test.scm in order in the load path?

library cache

  • The existing library cache system should work OK except include.
  • Ideally we should recreate cache when included file is newer than cache file.
    • I think we can go w/o this. library developer can use --disable-acc.
⚠️ **GitHub.com Fallback** ⚠️