开发者

What Scheme Does Ghuloum Use?

I'm trying to work my way through Compilers: Backend to Frontend (and Back to Front Again) by Abdulaziz Ghuloum. It seems abbreviated from what one would expect in a full course/seminar, so I'm trying to fill in the pieces myself.

For instance, I have tried to use his testing framework in the R5RS flavor of DrScheme, but it doesn't seem to like the macro stuff:

src/ghuloum/tests/tests-driver.scm:6:4: read: illegal use of open square bracket

I've read his intro paper on the course, An Incremental Approach to Compiler Construction, which gives a great overview of the techniques used, and mentions a couple of Schemes with features one might want to implement for 'extra credit', but he doesn't mention the Scheme he uses in the course.

Update

I'm still digging into the original question (investigating options such as Petit Scheme suggested by Eli below), but found an interesting link relating to Gholoum's work, so I am including it here.

[Ikarus Scheme](http://en.wikipedia.org/wiki/Ikarus_(Scheme_implementation)) is the actual implementation of Ghuloum's ideas, and appears to have been part of his Ph.D. work. It's supposed to be one of the first implementations of R6RS. I'm trying to install Ikarus now, but the configure script doesn't want to recognize my system's install of libgmp.so, so my problems are still unresolved.

Example

The following example seems to work in PLT 2.4.2 running in DrEd using the Pretty Big

(require lang/plt-pretty-big)

(load "/Users/donaldwakefield/ghuloum/tests/tests-driver.scm") 
(load "/Users/donaldwakefield/ghuloum/tests/tests-1.1-req.scm") 
(define (em开发者_如何学Cit-program x) 
  (unless (integer? x) (error "---")) 
  (emit " .text") 
  (emit " .globl scheme_entry") 
  (emit " .type scheme_entry, @function") 
  (emit "scheme_entry:") 
  (emit " movl $~s, %eax" x) 
  (emit " ret")
  )

Attempting to replace the require directive with #lang scheme results in the error message

foo.scm:7:3: expand: unbound identifier in module in: emit

which appears to be due to a failure to load tests-driver.scm. Attempting to use #lang r6rs disables the REPL, which I'd really like to use, so I'm going to try to continue with Pretty Big.

My thanks to Eli Barzilay for his patient help.


The language he uses is most likely Chez Scheme. Regardless, the R5RS language in PLT is a pretty strict version of R5RS, with extensions like square brackets throwing errors -- and you may get more mileage using the default #lang scheme language. (Or, if that fails, try and see if you can work with Petit -- the free version of Chez.)


You can see setup instructions for running it here on Ubuntu x86.

The installation download for Petite Scheme are here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜