A minimalist Lisp-inspired language
Project description
🐑 Lambdora
A ~2-kLOC Lisp-inspired functional language written in modern Python. Lambdora implements a full interpreter—lexer, parser, evaluator, and macro system in a compact codebase.
Features
- First-class anonymous functions with currying
- Lexical closures (static scope)
- Tail-call optimization via trampoline
- Hygienic macro system (
defmacro) for metaprogramming - Built-in data types: numbers, booleans, pairs/lists,
nil - Expressive functional standard library (
map,foldl,range, …) - Interactive REPL & script runner
- ~85% test coverage with pytest and Codecov integration
What's New in 1.7.1
- REPL multiline editing is more robust:
- Use
\bto remove the previous line in multiline mode. - Type
exitorquitat any point in multiline mode to cancel and return to the main prompt. - The multiline prompt is now always
...for clarity.
- Use
- Custom standard library path:
- Use
--stdlib-pathto specify a custom standard library file for the REPL or runner:lambdora repl --stdlib-path=my_stdlib.lamb lambdora run --stdlib-path=my_stdlib.lamb myscript.lamb
- Use
- REPL help improvements:
- The
helpcommand now documents all special commands, including\band multiline exit/cancel.
- The
Quick Start
Web REPL
No installation required - runs entirely in your browser using WebAssembly.
Local Installation
# Install from PyPI
$ pip install lambdora
# OR install from source
$ git clone https://github.com/ferecci/Lambdora.git && cd Lambdora
$ pip install -e .
# OR
$ make install
# launch REPL
$ lambdora repl
# run a script
$ lambdora run examples/fizzbuzz.lamb
# check version and help
$ lambdora --version
$ lambdora --help
Legacy commands still work:
$ python -m lambdora.repl
$ python -m lambdora.runner examples/fizzbuzz.lamb
Hello World
(print "Hello, Lambdora!") ; => Hello, Lambdora!
Usage Examples
(define inc (lambda x. (+ x 1)))
(define twice (lambda f. (lambda x. (f (f x)))))
((twice inc) 3) ; => 5
(defmacro when (cond body)
(if cond body nil))
(when true (print "hi")) ; => hi
Examples
Try the included examples:
- FizzBuzz - Classic programming problem
- Church Numerals - Functional programming concepts
- Macro Examples - Hygienic macro system
Architecture Overview
src/lambdora/
tokenizer.py # lexical analysis
parser.py # S-expression → AST
evaluator.py # evaluator with tail-call optimisation
macro.py # macro expander & hygiene
builtinsmodule.py # built-in functions
stdlib/std.lamb # functional standard library
Each module is <200 LOC and unit-tested, making the codebase easy to navigate and extend.
Testing
# install dev dependencies
$ pip install -e .[dev]
# run test-suite & watch coverage
$ pytest --cov # reports to terminal
A GitHub Action uploads coverage to Codecov (badge above).
Documentation
- Language Guide - Complete language overview and philosophy
- API Reference - Built-in functions and standard library
- REPL Guide - Interactive development guide
Contributing
Open an issue or pull request, everyone's welcome! See CONTRIBUTING.md for development guidelines.
License
MIT © Felipe Tancredo (ferecci)
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 lambdora-1.8.0.tar.gz.
File metadata
- Download URL: lambdora-1.8.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44b14de62846905d1db2ac7fb12a8f96cb464a9e7053f8cebcc8baac47844878
|
|
| MD5 |
8ceb954e29d2b792f9ea47eca766ecb8
|
|
| BLAKE2b-256 |
2f489018e86b8e45ed10d7b8f603fbc450a3f7595b9a2a319acdd89bbf35262b
|
File details
Details for the file lambdora-1.8.0-py3-none-any.whl.
File metadata
- Download URL: lambdora-1.8.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f62af1ff0e4bad26f41725b283115c4a4ad7606cf167982cbb707f7203962dde
|
|
| MD5 |
b1bf1d76720e0b6685d61e7728fe06b2
|
|
| BLAKE2b-256 |
2ff29548b0481c97d649c394f0b9976212230314d76a7c741ffd5ccf922a46de
|