GithubHelp home page GithubHelp logo

ischemia's Introduction

ischemia

Bootstrap Scheme interpreter written in Java, following Peter Michaux's articles.

Not terribly many things are supported, since the interpreter is only supposed to be sturdy enough to run the initial compiler. The following is the dump of the environment that shows all the primitive procedures available:

car apply quotient string->number set-car! char->integer symbol? eq? char? string? input-port? remainder close-input-file null? integer->char write read interaction-environment output-port? pair? cons open-input-file procedure? eof-object? symbol->string error eval write-char * + null-environment list string->symbol cdr open-output-file - read-char set-cdr! environment number->string peek-char integer? boolean? close-output-file load > = <

Floating point is not supported, neither are macros, vectors and many other features that make Scheme Scheme. There are some basic procedures for accessing environments; there are two branches available that represent variable bindings as a Java HashMap and a set of LISP lists. The first one doesn't allow any manipulation of environments, but is supposedly faster; the second one is the opposite. I'm not entirely sure whether one option is better than the other, so I'm keeping both branches.

I managed to run the metacircular evaluator on both versions.

It also has tail call optimization (unlike Java) via trampolines.

Error handling is minimal; giving things less arguments than they want or differently typed things from what they want is a sure way to a Java stack trace or an ambiguous error message passed via one of the only two existing exceptions.

ischemia's People

Watchers

 avatar  avatar

ischemia's Issues

Lambdas cannot be applied directly

E.g expressions of type ((lambda (x) (+ x 1)) 42) cannot be evaluated since the interpreter tries to look up the procedure with the name (lambda (x) (+ x 1))

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.