Lisp-like Syntax for Python with Lisp-like Macros
Project description
LisPython
LisPython is a Lisp-flavored syntax for Python with Lisp-style macros. Source files (.lpy) are transpiled to Python and executed on the standard CPython runtime.
Documentation
Full documentation lives at https://jetack.github.io/lispython/.
Quick Start
(import math)
(def area [r]
(return (* math.pi (** r 2))))
(print (area 3))
lpy example.lpy
Installation
Using pip
pip install lispython
Manual Installation (for development)
uv sync # install dependencies
uv pip install -e . # for development
How to Run LisPython code
Run from source
lpy {filename}.lpy
Run REPL
lpy
# or
lpy -t # if you want to print python translation.
Show translation
l2py {filename}.lpy
Prints the translated Python to stdout. It does not execute the code.
Run Tests
# in project root directory
pytest
# or
lpy -m pytest
LSP Server
LisPython ships with a language server (lpy-lsp) that speaks LSP over stdio. It provides:
- Diagnostics (parse / compile errors)
- Hover documentation for special forms
- Document symbols
- Go-to-definition, including across
.lpyfiles in the workspace
Editor setup
Point your editor's LSP client at the lpy-lsp command for files with the .lpy extension. The server speaks LSP over stdio.
VSCode
Install the LisPython extension from the VSCode Marketplace.
Emacs
Use lpy-mode for syntax highlighting and LSP integration. For completion, install lpy-autocomplete.
Todo
Environment
- Test on more python versions
- REPL should track history and arrow key navigation
- REPL multi-line input support
- Better compilation error messages
Macro System
-
as->macro for syntactic sugar -
gensymfor avoiding name collision
Python AST
-
type_commentnever considered. Later, it should be covered - Any missing AST nodes in the version 3.12+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lispython-0.4.1.tar.gz.
File metadata
- Download URL: lispython-0.4.1.tar.gz
- Upload date:
- Size: 72.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eba57cb24f2f6341fdd5e42a2da5fabcd20eb9800fa18f18803175c6b903030a
|
|
| MD5 |
368fbdfc2c6c9f205805bca2c0f01140
|
|
| BLAKE2b-256 |
ae1fa19dcac9a496fe0ce3c1a4512f05b9be2a0fa04643ebb4b306cb4dd0e5ca
|
File details
Details for the file lispython-0.4.1-py3-none-any.whl.
File metadata
- Download URL: lispython-0.4.1-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbb8a074c9ecae6a016b6b7c042452580feb4b1c2f157744a1f06057964b26eb
|
|
| MD5 |
48a8ffc5a6eecb6bbb6a7ea252c6dcea
|
|
| BLAKE2b-256 |
af0f4f8a9931ac17bb25ca1543a9bc5e41e0fe908fb53622ce76ed7ebe23129c
|