Skip to content
Python S-expression Intermediate Language
Find file
Latest commit c2fd06a Jan 11, 2011 @ghewgill add README

Psil - Python S-expression Intermediate Language

Greg Hewgill

Psil is a Lisp family language designed for close integration with Python.


Psil requires Python 3.1 or later.


To run a REPL (interactive read-eval-print-loop):

$ python3.1
PSIL interactive mode
Use (quit) to exit

To run a Psil script in a file:

$ python3.1 hello.psil
hello world

or (on Unix-like systems):

$ ./hello.psil
hello world

To run Psil code from within Python:

#!/usr/bin/env python3.1

from psil.interpreter import psil

square = psil("""
    (lambda (x)
        (* x x))


A slightly more advanced example where the glob=globals() is needed so that the Psil code can see back into the Python module for the fact function:

#!/usr/bin/env python3.1

from psil.interpreter import psil

fact = psil("""
    (lambda (x)
      (if (== x 0)
          (* x (fact (- x 1)))))
""", glob=globals())


The psil.test file is a doctest module with many examples including macros. To run the tests:

$ python3.1 --test
Something went wrong with that request. Please try again.