Skip to main content

A minimalist Lisp-inspired language

Project description

🐑 Lambdora

codecov Python License

A 1-kLOC Lisp-inspired functional language written in modern Python. Lambdora implements a full interpreter—lexer, parser, evaluator, and macro system in a compact codebase.

Lambdora REPL

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

Quick Start

# 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:

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

Contributing

Open an issue or pull request, everyone's welcome! See CONTRIBUTING.md for development guidelines.

License

MIT © Felipe Tancredo (ferecci)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lambdora-1.7.0.tar.gz (30.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lambdora-1.7.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file lambdora-1.7.0.tar.gz.

File metadata

  • Download URL: lambdora-1.7.0.tar.gz
  • Upload date:
  • Size: 30.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for lambdora-1.7.0.tar.gz
Algorithm Hash digest
SHA256 1e0596c09fc68985c6c2b78cd175ab3baa961d392e37e31f5c1e3429c276597a
MD5 bcb26cc7a6bcb46965817e268f39414b
BLAKE2b-256 f592d7258f6b4c140a398af7a9c5c20d7d404b1ebb78704029664e29c725e414

See more details on using hashes here.

File details

Details for the file lambdora-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: lambdora-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for lambdora-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1ae371a67ae7e32c1e28017c35b4215601fbf05ea25d93751a03a1e05c4eff7
MD5 23f85fff759ae00002a9d2124ba3b247
BLAKE2b-256 9a1719c776747b783611a76aa12919b35200889524397bcc34923dd22b9c0624

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page