Code Monkey home page Code Monkey logo

scheme-ish's Introduction

Scheme-ish

Group Name

idk to be determined

  • Ethan Zhang (ethanz4)
  • Ian Chen (ianchen3)

Project Overview

A simple, tree-walking interpreter for a subset of the Scheme programming language written in Rust. For those unfamiliar with Scheme, it is a mostly-functional programming language in the Lisp family originally developed at MIT CSAIL, and taught in the influential intro CS textbook (and MIT course of the same name) Structure and Interpretation of Computer Programs (SICP).

We chose this project because Scheme is a very elegant language (that is very easy to parse) and is thus considered to be one of the canonical languages for writing your first programming language interpreter. Additionally, our high school taught out of the first half of SICP, so both of us already have some experience with Scheme.

Technical Overview

There are three fundamental parts to every interpreter:

  • the lexer, which transforms a sequence of characters (your code) into a sequence of tokens
  • the parser, which takes a sequence of tokens and constructs an abstract syntax tree (AST)
  • the evaluator, which walks the AST, evaluating the code step by step

As an additional component, we would like to include a repl (read-eval-print loop), as it is an essential part of the Scheme development workflow.

Checkpoint 1

  • Lexer (Converting S-expressions to tokens)
    • Tokens include things like parens, numbers, booleans, keywords, identifiers, etc.
  • Parser (Create AST)
    • Create a CFG for the language
    • Write a simple parser for the CFG
  • Evaluator:
    • Be able to evaluate simple scheme programs with the following features:
      • basic arithmetic, e.g.
        (+ (/ (* 2 4) 2) (- 8 4))
      • variable definition, e.g.
        (define x 5)
        (define y 10)
        (+ x y)
      • conditionals, e.g.
        (define x 5)
        (define y 10)
        (if (< x y) x y)

Checkpoint 2

  • Evaluator:
    • lambdas, e.g.
      ((lambda (x) (* x x)) 5)
    • other language features
  • repl:
    • CLI

Possible Challenges

  • Creating the CFG for the language
  • How do we represent a scope / current state / environment
  • Interactivity + graceful error handling

Potential References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.