Tina Liu, Chae Kim, James Yang
Our interpreter project takes in a file of Scheme codes and evaluate them according to the syntax of R5RS, a dialect of Scheme.
Our project supports methods that include:
- Special forms: let, letrec, let*, quote, define, lambda, set!, and, or, cond, begin
- Primitive functions: +, -, *, /, null?, car, cdr, cons, <=, pair?, eq?
- Library procedures (the following functions can be used by calling (load "XX.scm") in your file):
i) library.scm: not, equal?
ii) math.scm: =, zero?, >=, <, >, positive?, negative?, abs, truncate, ceiling, floor, round, modulo, even?, odd?, max, min, gcd, lcm
iii) lists.scm: list, append, caar, cadr, list?, length, list-ref, list-tail, member
Here is the list of extensions we implemented for this project:
- lambda/let/letrec/let* support multiple body expressions, in which case they evaluate all and return the last one
- if supports missing alternative statement
- 'expr works as an alternative to (quote expr)
- Our tokenizer/parser/intepreter give out informative error messages
- Supports the syntactic sugar for binding variables to procedure
- Supports internal definitions in the body of lambda/let/letrec/let* expressions (unless define is the last in the body with no preceding non-definition expressions (matches behavior of DrRacket))
- Supports correct return types for + (ex. it returns an integer if all the input numbers are integers)
- Supports dotted pair notation for input
- Implements the function "load" such that (load "filename") will read the file and execute the Scheme codes within it
- Supports correct behaviors for the primitive functions - and / such that it allows only one argument as well
- Cond supports clauses with zero or more arguments
- We support additional built-in functions for lists.scm: caar, cadr, list?, length, list-ref, list-tail, member
- We support additional built-in functions for math.scm: =, >=, <, >, zero?, positive?, negative, even?, odd?, max, min, abs, gcd, lcm, modulo, floor, ceiling, truncate, round
Thanks for viewing our project!