Git Product home page Git Product logo

peaze's Introduction

peaze logo

Peaze

A lisp-like programming language running on JVM.

About Peaze

Peaze is a lisp-like programming language. It has extremely flexible syntax just like lisp and provides easy access to Java frameworks.

The kernel features of Peaze include lexical scope, first-class procedures, proper treatment of tail calls, continuations, user-defined records, libraries, exceptions, and hygienic macro expansion.

Peaze is implemented with java8, currently the AST interpreter is under developing. The developing of the interpreter is in a very early stage, only a few features are supported. You could see more details at Roadmap.

Examples

1. A runnable example that calculates the n'th fibnacci number:

;;; iterative version
(define (fib-iter n)
        (define (fib-iter-help n f1 f2)
                (if (= n 1)
                  f1
                  (fib-iter-help (- n 1) f2 (+ f1 f2))))
        (fib-iter-help n 1 1))

;;; 55
(display (fib-iter 10))

;;; 1820529360
(display (fib-iter 60))

2. A runnable example that demonstrates the lexical closure feature:

;;; multi levels varaible capture
;;;

(define (addxyz x)
        (lambda (y)
                (lambda (z)
                        (+ x y z))))

(define add1-y-z (addxyz 1))
(define add1-2-z (add1-y-z 2))
(define add1-3-z (add1-y-z 3))
;;; 6
(display (add1-2-z 3))
;;; 14
(display (add1-3-z 10))

Try it

To run Peaze source code, you need to build this project first:

  1. Install maven in your system.
  2. Clone this repository:
git clone https://github.com/pzque/peaze.git
  1. Build this project with commands:
cd peaze
mvn package

After the building process, you'll get the executable jar file in the "target" folder. It will be named "peaze-0.0.1-jar-with-dependencies.jar", which is the main entry of our interpreter.

We provides several Peaze source files in the "examples" folder, now you could run them with our interpreter. For instance:

cd examples
java -jar ../target/peaze-0.0.1-jar-with-dependencies.jar fib.pz

Roadmap

kenerl features

  • s-expression
  • variable/function definition and reference
  • function call
  • first class function
  • lexical scope and closure
  • anonymous function: lambda
  • branch: if
  • assign: set!
  • first class continuation: call/cc
  • macro

basic types

  • char
  • boolean
  • integer
  • rational
  • real
  • complex
  • string
  • symbol
  • pair(list)
  • vector

builtin procedures

  • +,-,*,/
  • =, <=, >=, <, >
  • cons, car, cdr

builtin macros

  • and
  • or
  • cond
  • case
  • let
  • let*
  • letrec

peaze's People

Contributors

petrizhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

peaze's Issues

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.