67
GitHub - php-lisp/php-lisp: php-lisp is a Lisp dialect written in PHP.
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)
introduction
- Unit test coverage is 93%
- All use
PHP declare (strict_types = 1);
strict mode - Core interpreter 0 relies on only 57K packaged phar files
installation
- 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
- The clone code
git clone [email protected]:php-lisp/php-lisp.git
cd php-lisp && composer install && ./bin/psp -h
use
- Use the REPL
./psp
- Check out help
./bin/psp -h
- 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
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK