https://github.com/lamdav/schemeinterpreter
A Scheme Interpreter written for CSSE304.
https://github.com/lamdav/schemeinterpreter
interpreter scheme scheme-interpreter scheme-language
Last synced: 4 months ago
JSON representation
A Scheme Interpreter written for CSSE304.
- Host: GitHub
- URL: https://github.com/lamdav/schemeinterpreter
- Owner: lamdav
- Created: 2017-04-17T19:52:24.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-13T17:46:29.000Z (about 8 years ago)
- Last Synced: 2025-02-24T03:32:57.071Z (4 months ago)
- Topics: interpreter, scheme, scheme-interpreter, scheme-language
- Language: Scheme
- Size: 122 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scheme Interpreter
A Scheme Interprester built in Scheme to interpret Scheme.
## Authors
David Lam
Adam Finer## Branch Details
There are two branches: `master` and `pass-by-reference`.The `master` branch contains most major milestone work for the class. The `pass-by-reference` branch contains an experimental feature in which our interpreter allowed the usage of 2 unique features not native to `scheme`: passing-by-reference and lexical addressing. To accomplish this, our interpreter heavily uses the ADT `chez-scheme` provides: `Box`.
Passing-by-reference feature allows an individual to create a `scheme` procedure such that certain parameters were to be taken as references rather than values. We accomplished this by creating a special `parameter` datatype and updating our parser to handle `ref` procedure parameters (i.e. `(lambda ((ref x)) ...)`). We also updated our `environment` datatype to store a vector of `Boxes`. Therefore, whenver our `closures` required a `ref` parameter, it would be passed the `Box` itself. Otherwise, the parameter would get the value within the box instead.
As for lexical addressing, we simply updated our parsing pipeline. After parsing the inital expressions and syntax expanding the parsed expressions, we then lexically addressed the expanded expression before attempting to evaluate it. This served to help improve our lookup time as we now know the lexical depth and lexical position within the chains of local environments or global environment if the variable was free.
## Zipping Files
As the project grew, it became obnoxious to zip the proper files to turn it in to the grading server. To overcome this entirely, David wrote `zip.js`, a NodeJS script, that will find all `.ss` or `.scm` files within a specified source directory and zip it all up into `interpreter.zip`.
To zip the files, run the following command:
```
node zip.js
```Currently, this repo is setup with an npm scripts that will default the `source_directory` to be `src`. To execute this, run the following command:
```
npm start
```