Looking for explanation on Racket's C code & core systems implementation (hello from Shaka Scheme)

133 views
Skip to first unread message

Austin T

unread,
Mar 5, 2017, 8:16:11 AM3/5/17
to Racket Developers
Hello,

I am currently the lead developer on a student project that is doing an independent implementation of R7RS Scheme in C++11. I am looking at other Scheme implementations as we are currently tackling the first of the primitive expressions, and I would love to see how other people do it.

We are taking a pointer-based tree model as our implementation for simplicity. One of our tentative and internal goals for the project is to create great documentation so that those that are looking into implementing languages can begin to learn by looking at a simple evaluation model.

I would like to know:
  • What should I read? I tried reading some of the Racket Manifesto, but I care much more about the systems evaluation parts of the implemnetation for C. Namely:
    • Expressing Scheme types in C data structures 
    • Disjoint types as defined by some specification of Scheme
    • Garbage collection vs. reference counting (we are using C++11's std::shared_ptr for now for reference counting)
    • Paradigms to storing and handling arbitrary lists and expressions
    • Parsing input from characters & type of algorithm used
  • What should be improved about the design of the C-based systems?
    • I am also looking at Chez Scheme. I've taken a look at Chibi as well, but it's really quite hard to find the design bits in the comments and documentation.
    • It's be great if I could find some presentations!
If you're gotten here, thank you for reading! We are a small group at the University of Hawaii, and we would be glad to receive any sort of advice or help!

Thank you,
Austin Tasato
UH Manoa Transpiler Project




Jens Axel Søgaard

unread,
Mar 5, 2017, 9:34:26 AM3/5/17
to Austin T, Racket Developers
Hi Austin,

> I would like to know:
>  - What should I read?

Since Scheme is an old language the literature on Scheme compilers is surprisingly rich.

Some of the classics (can't recommend these enough): 
      "Lisp in Small Pieces" by Christian Queinnec
      This book is a delight to read - and even includes a chapter on compiling to C.

      "Three Implementation Models for Scheme" by R. Kent Dybvig
      Dybvig's thesis. Very clear explanations. Explains how to implement 
      using a stack of frames (like C).

> - Expressing Scheme types in C data structures

Take a look at how Larceny represents Scheme values. The approach is fairly typical.

> Garbage collection vs. reference counting
Reference counting has problems with cyclic data that becomes dead.
A simple stop-copy garbage collector would be a good place to start.

    "Programming Languages: Application and Interpretation" (PLAI( by Shriram Krishnamurthi
has a chapter on memory management:
(There is a nice language for implementation garbage collectors available.
 I can't find the linked exercises - have they moved?)

> Parsing input from characters & type of algorithm used
The Scheme Compiler Workshop has a section on writing a scanner and parser:

--
Jens Axel Søgaard

--
You received this message because you are subscribed to the Google Groups "Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-dev+unsubscribe@googlegroups.com.
To post to this group, send email to racke...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-dev/964a694a-ef98-4327-b687-1b3f6f64f726%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--
Jens Axel Søgaard

Reply all
Reply to author
Forward
0 new messages