Code Monkey home page Code Monkey logo

plisp's Introduction

PLISP - Palm's Lisp

A rudimentary Java LISP implementation, based on the language description in the paper "The Roots of Lisp" by Paul Graham. The interpreter was written as a personal exercise to better understand interpreter and compiler construction. Also, LISP has been a subject of personal interest for quite some time, and this project gave an excuse to investigate the topic.

The implemented language only defines two significant constructs, atoms and conses. An atom is, in essence, a string identifier that has no other significance than being an identifier. A cons is a pair of memory cells, CAR and CDR, which may be used to refer to other atoms or conses. A valid program only contains a single expression.

Example:

(
    (label subst (lambda (x y z)
        (cond
            ((atom z) (cond
                ((eq z y) x)
                ('t z)
            ))
            ('t (cons
                (subst x y (car z))
                (subst x y (cdr z))
            ))
        )
    ))
    (
        (label cadr (lambda (x) (car (cdr x))))
        (cadr
            (subst 'hello_world '2 '(1 2 3))
        )
    )
)

Installation

Clone the repository to a local directory of your choice.

$ git clone https://github.com:emanuelpalm/plisp.git

Use gradle to compile the project into a JAR and generate a default start-up script.

Windows:

> gradlew.bat installApp

Other:

$ ./gradlew installApp

The build results of interest will be in the build/install/plisp directory, relative to the project root.

Basic Usage

Assuming the project has been installed, the current directory is the project root, and the used machine is running a unix-like system, the following command may be used to run the bundled example application:

$ ./build/install/plisp/bin/plisp example.plp

Also, the interpreter contains a rudimentary static analyzer that may be invoked by adding the flag --analyze when running. If used, the loaded program is only analyzed. An example of running the analyzer on the example application would be as follows:

$ ./build/install/plisp/bin/plisp example.plp --analyze

plisp's People

Contributors

emanuelpalm avatar

Watchers

James Cloos avatar  avatar

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.