php-lisp is a Lisp dialect written in PHP.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
examples
release
src
tests
.editorconfig
.gitattributes
.gitignore
.php_cs
.phplint.yml
.scrutinizer.yml
.styleci.yml
.travis.yml
LICENSE
README.md
README_zh.md
box.json
composer.json
composer.lock
phpunit.xml.dist

README.md

PHP - lisp

php-lisp is a lisp interpreter written in PHP (just for fun)

Build Status codecov.io Code Intelligence Status StyleCI Latest Stable Version Licence Total Downloads Gitter chat

简体中文

introduction

  1. Unit test coverage is 93%
  2. All use PHP declare (strict_types = 1); strict mode
  3. Core interpreter 0 relies on only 57K packaged phar files

installation

  1. Install using composer composer require php-lisp/php-lisp

Download the Phar file wget https://github.com/php-lisp/php-lisp/releases/download/v1.0.1/psp

  1. The clone code
    git clone git@github.com:php-lisp/php-lisp.git
    cd php-lisp && composer install && ./bin/psp -h

use

  1. Use the REPL
./psp 
  1. Check out help
 ./bin/psp -h
  1. Execute PSP code
echo '(define zero (lambda (f) (lambda (x) x))) 
      (define one (lambda (f) (lambda (x) (f x)))) 
      (define plus (lambda (m n) (lambda (f) (lambda (x) ((n f) ((m f) x)))))) 
      (define mult (lambda (m n) (lambda (f) (lambda (x) ((n (m f)) x))))) 
      (define xp (lambda (m n) (lambda (f) (lambda (x) (((n m) f) x))))) 
      (define pr (lambda (x) (do (echo x) x))) 
      (define prn (lambda (n) (do ((n pr) ".") (echo "\n")))) 
      (define two (plus one one)) 
      (define three (plus two one)) 
      (define six (mult two three)) 
      (define sixty-four (xp two six)) 
      (prn sixty-four)'  >> church-encoding.psp  && ./bin/psp church-encoding.psp

More Demo look at https://github.com/php-lisp/php-lisp/tree/master/examples

reference

REPL LISP pharen lispphp mal pEigthP

Communication and feedback

Email: itwujunze#gamil.com