https://github.com/ecto/loon
the lisp I always wanted
https://github.com/ecto/loon
dope language lisp rust
Last synced: 3 months ago
JSON representation
the lisp I always wanted
- Host: GitHub
- URL: https://github.com/ecto/loon
- Owner: ecto
- Created: 2023-09-27T21:17:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-03-25T12:25:12.000Z (3 months ago)
- Last Synced: 2026-04-02T19:43:41.180Z (3 months ago)
- Topics: dope, language, lisp, rust
- Language: Rust
- Homepage: https://loonlang.com
- Size: 2 MB
- Stars: 117
- Watchers: 7
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Roadmap: ROADMAP.md
Awesome Lists containing this project
README
# loon
A functional language with invisible types, safe ownership, and algebraic effects.
**[Try it in your browser →](https://loonlang.com/play)**
```
[fn greet [name]
[println "Hello, {name}!"]]
[pipe [range 1 10]
[filter [fn [n] [> n 4]]]
[map [fn [n] [* n n]]]
[each println]]
```
## Features
- **Type Inference** — Full Hindley-Milner with let-polymorphism and row types. No annotations required.
- **Ownership** — Rust-style move semantics and borrow checking, inferred from dataflow. No lifetimes.
- **Algebraic Effects** — Declare, perform, and handle effects. Replaces exceptions, async, and mutable state.
- **Pattern Matching** — Positional pairs with destructuring and expression guards.
- **Type Methods** — Define methods inside `type` declarations with automatic dispatch.
- **Macros** — Template macros with quasiquoting. Procedural macros with compile-time IO.
- **Pipes** — Thread data through transformation chains. No nesting, no temp variables.
- **Language Server** — Diagnostics, hover types, go-to-definition, completions, inlay hints.
- **WASM** — Compiles to WebAssembly with closures, ADTs, and tree-shaking.
## Quick Start
```bash
curl -fsSL https://loonlang.com/install.sh | sh
```
```bash
loon run hello.oo # Run a program
loon repl # Interactive REPL with time-travel
loon fmt hello.oo # Format source
loon explain E0201 # Interactive error tutorial
```
## Architecture
```
loon/
├── crates/
│ ├── loon-lang/ # Core: parser, type checker, interpreter
│ ├── loon-cli/ # CLI: run, repl, fmt, explain
│ ├── loon-lsp/ # Language server protocol
│ └── loon-wasm/ # WASM bindings for browser
├── web/ # Website (written in Loon)
│ ├── public/ # Static assets, WASM bootstrap
│ └── src/ # Loon source: pages, components, router
├── tree-sitter-loon/ # Tree-sitter grammar
├── samples/ # Example programs
└── tests/ # Test suite
```
## Development
```bash
# Run tests
cargo test --workspace
# Build WASM + dev server
cd web && npm run dev
# Build language server
cargo build -p loon-lsp --release
```
## License
[MIT](LICENSE)