Coder Social home page Coder Social logo

starlisp's Introduction

starlisp

A Common LISP with support for *Lisp and other useful features.

LISP on the jvm impl inspired by "A Lisp compiler for the JVM" ANTON KINDESTAM http://www.csc.kth.se/utbildning/kth/kurser/DD143X/dkand12/Group2Mads/report/AntonKindestam.pdf

Starlisp: Connection Machine *Lisp implementation

features

Starlisp is currently interpreted, though plans for enabling compiling to jasmin are planned.

Starlisp supports:

  • Server-friendly runtime contexts (environments). See lispserver for an example.
  • lexical scoping.
  • java interop using the dot syntax (.toString obj)

Planned

  • Embedded web server to enable online debugging and REPL
  • Interfacing with Finagle for good async execution
  • backquotes

TODO

  • [fix] java interop using the dot syntax (.toString obj)

building

compile:

$ mvn clean install

run the REPL:

$ java -jar target/org.starlisp.core-0.0.1-jar-with-dependencies.jar

examples

bootstrap:

$ java -jar target/org.starlisp.core-0.0.1-jar-with-dependencies.jar

try:

(defun foo (x) (+ x x))
(aeq 2 (foo 1))
(aeq 1 (1- 2))
(aeq 3 (1+ 2))

scope excercises:

(set 'x 1)
(aeq 16 (progn (set 'x 8) (+ x x)))
(aeq 8 x)

(aeq 1 (let () 1))
(set 'q 10)
(aeq 1 (let ((q 1)) q))

(let ((a 1)) (+ a a))
(let ((a 1) (b 2)) (+ a b))
(let ((a 1) (b 2)) (cons a (cons b #(hej din fisk (1 2 3)))))

(let ((a 1) (b 2)) (cons a '(#\W (1231312312312312312312312312312313123 . 5343412914294967296) (<a> <b> <c>) b #(hej din fisk (1 2 3)) "potatismossa" . 12.4)))

other examples:

(fib-trec 100)

(aeq 1 (subst-symbols '<a> '(<a> 1)))
(aeq '(+ 1 2) (subst-symbols '(+ <a> <b>) '(<a> 1 <b> 2)))

(defun foo (tree replacings)
  (progn
    (prin1 (env-depth))
    (if (atom? tree)
        (progn (prin1 '>>)
               (prin1 (env-depth))
               (prin1 tree)
               (prin1 '<<))
        (progn (prin1 '$)
               (prin1 tree)
               (prin1 (env-depth))
               (prin1 '$)
               (prin1 (car tree))
               (let ((q (car tree))) (foo4 q (cdr replacings)))
               (prin1 '[)
               (prin1 (env-depth))
               (prin1 tree)
               (prin1 '])
               (foo4 (cdr tree) (cdr replacings))))))

(foo '(+ <a> <b> <c>) '(<a> 1 <b> 2))

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.