← Back to context

Comment by glouwbug

7 days ago

I believe MIT Scheme compiled directly to C by intermingling switch statements and gotos to emulate its call stack. Problem was, as programs grew, compile times weren't linear. I gave it a shot once, it was a somewhat spiritual experience:

https://github.com/glouw/switch

Thanks! Do you mean MIT Scheme's C backend? I've used MIT Scheme on and off for a long time and have never touched the C backend & have no idea how it works, so this is interesting.

(MIT Scheme also has a native code compiler for Intel CPUs, which seems to be what most users of MIT Scheme (an admittedly small community) actually use.)

I think a very rudimentary implementation (which is easy to understand) is in the SICP book

  • Even MIT Scheme was used with SICP, the Scheme implementation in the book is different from MIT Scheme.

    MIT Scheme was for a long period one of the leading Scheme implementations. It lacks support for Apple Silicon, so it is not as popular now, as it once was.

    https://www.gnu.org/software/mit-scheme/

    • Yes. In Apple the memory can be writable XOR executable. MIT scheme needs to write on pages that will execute, so it will trigger the MMU..

    • Install chicken scheme. Then:

             sudo chicken-install srfi-203
      
             sudo chicken-install srfi-216
      

      At ~/.csirc put:

          (import scheme)
          (import (srfi 203))
          (import (srfi 216))
      

      Now you can do nearly all the execises.