PicoLisp is a small Lisp interpreter that tries to stay true to the path of 'code is data' as much as possible. It has some nice features, including a persistent database and built in prolog engine. The system is quite reflective and this is shown in the way you can use vim to browse the live system.
There is a 32-bit and 64-bit version. The 64-bit version has some nice additional features but for running on Android the 32 bit version is needed. Building for Android is fairly easy. The approach is similar to the way I built Wasp Lisp on Android.
The first step is to install a 'standalone toolchain' version of the Android NDK. The steps to do this is described in my Wasp Lisp post so I won't repeat them here. The main complication for my setup was getting this to work on NixOS. I created a Nix package definition to install the NDK and generate the standalone toolchain.
The 32-bit version of picoLisp is built from the
src subdirectory in the source download. Some minor changes are needed to use the Android cross compiler from the standalone toolchain. I've put these in android.patch. To apply the patch and build:
$ tar xvf picoLisp-3.1.6.tgz $ cd picoLisp $ curl http://bluishcoder.co.nz/picolisp/android.patch | patch -p1 $ cd src $ make TARGET=Android
To make testing easier I push the entire PicoLisp install to my Android device. For JellyBean and above it might be hard to find a place to install it with the correct permissions. On my KitKat device I can use
/data/local/tmp even though that directory isn't visible by listing it. You can push to it and
cd to it from the shell:
$ cd picoLisp $ adb push picoLisp /data/local/tmp/picoLisp
PicoLisp creates some files in the
.pil directory off the
HOME directory. This should be explicitly set when running it in the Android shell since the
HOME directory is not writeable:
$ adb shell $ cd /data/local/tmp/picoLisp $ HOME=/data/local/tmp ./pil + : (+ 1 2) -> 3
Unfortunately the 32-bit version of PicoLisp doesn't have the Native C Calls that the 64-bit version has. It does allow inline C code but this requires a
gcc compiler to be available. It may be possible to use a natively compiled gcc.
In the meantime it's possible to write shared libraries in C which can be loaded on Android. An example of doing this is ext.c in the distribution. This is already compiled and copied to Android in the steps above. Any Lisp symbol prefixed by a name plus ':' is checked if it exists in a shared library with the given name. So the symbol
ext:Snx is the
Snx function in the
ext shared library. An example of calling this in Android:
: (ext:Snx "hello") -> "HL"
Running the PicoLisp webserver on Android looks like:
$ cd /data/local/tmp/picoLisp $ HOME=/data/local/tmp ./pil @lib/http.l --server 8080 @doc/hello.l -wait
This can be accessed from the web browser on the device at
Unfortunately in recent versions of Android (at least KitKat) it's not possible to run PicoLisp from
/data/local/tmp from within the terminal emulator apps available on the App store as far as I can see. I get permission denied errors. Earlier versions of Android work in my testing. If your phone is rooted this won't be a problem, it should work. I've also tested PicoLisp on a rooted Firefox OS phone and it works fine. Writing server side programs in PicoLisp that can be accessed as Web Applications on Firefox OS could be an interesting project for testing and prototyping ideas.
Other users have gotten PicoLisp running on Android as well: