A project description and test harness for developing a simple Scheme interpreter
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
Makefile
README.md

README.md

Author: Matt Might Site: http://matt.might.net/

Implementing MicroScheme

Your task is to implement an interpreter for MicroScheme.

MicroScheme has the following grammar:

<prog> ::= <defs> <exp>

<defs> ::= <def> <defs>
        |  

<def> ::= (define (<var> <formals>) <exp>)

<formals> ::= <var> <formals>
           |  

<exp> ::= <integer>
       |  <var>
       |  #t | #f
       |  (lambda (<formals>) <exp>)
       |  (let ([<var> <exp>] ...) <exp>)
       |  (if <exp> <exp> <exp>)
       |  (set! <var> <exp>)
       |  (begin <exp> ...)
       |  (<prim> <exp> ...)
       |  (<exp> <exp> ...)
       |  (call/cc <exp>)

<prim> ::= +  |  -  |  *  |  = 
        |  void  

Your interpreter should execute the script on stdin and print the final result.

Tips

There are a variety of viable implementation strategies:

I strongly recommend that you use Racket (or some dialect of Scheme) for this project, since the (read) command handles lexing and parsing for you.

You may find the stub code provided in microscheme.rkt useful, but you are not required to use it.

Testing

With Racket installed, you can build the expected results for the test cases.

With s-diff installed, you can compare your interpreter to the expected results with:

make test

Restrictions

You may not use the eval command in any Scheme distribution, including Racket.