I have created Spoofax project for R5RS scheme:

https://github.com/metaborg/metaborg-r5rs

This shows a shortcoming in NaBL, i.e. support for variations on let constructs (which we discussed before). The semantics of the let constructs are described as follows in the report (http://www-sop.inria.fr/indes/fp/Bigloo/doc/r5rs-7.html#Binding-constructs):

The three binding constructs let, let*, and letrec give Scheme a block structure, like Algol 60. The syntax of the three constructs is identical, but they differ in the regions they establish for their variable bindings. In a let expression, the initial values are computed before any of the variables become bound; in a let* expression, the bindings and evaluations are performed sequentially; while in a letrec expression, all the bindings are in effect while their initial values are being computed, thus allowing mutually recursive definitions.

The following is a sketch of this semantics in NaBL, but only the definition of LetRec works:


binding rules // let

LetRec(_, _) :
scopes Variable

LetStar(bindings, body) :
imports Variable from bindings into body

LetStarBindingSpec(name, e) :
defines Variable name in subsequent scope

Let(bindings, body) :
scopes LetScope
implicitly defines LetScope “let”
imports Variable from “let” into body

LetBindingSpec(name, e) :
defines Variable name in s
where “let” refers to LetScope s

Submitted by Eelco Visser on 17 November 2013 at 14:53

Log in to post comments