67

GitHub - php-lisp/php-lisp: php-lisp is a Lisp dialect written in PHP.

 5 years ago
source link: https://github.com/php-lisp/php-lisp
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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 [email protected]: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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK