PiLisp—An interpreted Lisp inspired by Clojure.
Runs on all supported Dart targets.
Alpha. Much works, much may change.
This is the pilisp
package on pub.dev.
Features
This package implements the core PiLisp language that works across Dart VM, native compilation, Flutter, and web targets.
The core language supports:
- Clojure syntax
- Immutable data structures
- Macros
- Lexical closures
- Functions for many Dart Core classes and methods
- A growing subset of Clojure's functions/macros
By design and due to differences between the Java and Dart virtual machines, there are many areas where PiLisp differs from Clojure. See Comparison of PiLisp & Clojure for more information.
Usage
- Download a release for standalone CLI usage.
dart pub add pilisp
to add as a library to your Dart project.
For CLI use, download the latest release for your platform and run the pl
executable.
$ pl
pl>
Run the help
command for all options:
$ pl help
Run a PiLisp REPL, or try the subcommands for more options.
Usage: pl <command> [arguments]
Global options:
-h, --help Print this usage information.
Available commands:
eval Evaluate PiLisp code passed as arguments.
load Load PiLisp code saved in files.
repl Start a PiLisp REPL.
Run "pl help <command>" for more information about a command.
For use in your Dart programs, PiLisp.loadString
will read and evaluate
program source:
PiLisp.loadString('(+ 1 2 3 4)');
Additional information
- TODO PiLisp Language Tutorial
- PiLisp Core Implementation
- PiLisp Core Tests
- TODO Embedding PiLisp in Dart Programs
- pilisp-native that takes advantage of host facilities (e.g.,
dart:io
) - pilisp-web that compiles to JavaScript targeting the Web
The name "PiLisp" was originally a shortened form of "Piped Lisp," because a
first prototype of this language was developed while building a REPL
for the Shortcut project management
SaaS product that included a rudimentary Lisp whose defining feature was use of
the pipe character |
as an equivalent of Clojure's thread-first macro ->
.
Build
- Clone this repository
- Run
dart pub get
- Run
./script/compile
Acknowledgements
Initial implementation of the reader was based on ClojureDart's reader.cljd licensed under the Eclipse Public License (EPL-1.0).
A rewrite of the reader was adapted from dlox's scanner.dart licensed under the MIT License.
Much of PiLisp's implementation (both Dart and PiLisp code) was copied and adapted directly from the Java and Clojure source code in the Clojure project licensed under the Eclipse Public License (EPL-1.0).
License
Copyright © Daniel Gregoire 2022–2023
Eclipse Public License - v 2.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.