No description
  • Fennel 99.6%
  • Makefile 0.3%
Find a file
2026-05-14 10:53:26 +03:00
src no need to store mangled syms in the permastate 2026-05-14 10:53:26 +03:00
tasks refactoring 2026-05-14 02:11:07 +03:00
test fix namespacing bug 2026-05-14 08:45:20 +03:00
.fennel-test add settings for fennel-test 2026-03-16 02:30:54 +03:00
.gitignore rework project structure, fix compiler bugs 2026-03-20 22:47:45 +03:00
deps.fnl refactor defn compilation to support letfn 2026-05-13 11:55:24 +03:00
DIFFERENCES.md support for and doseq 2026-04-06 02:23:11 +03:00
flsproject.fnl remove cljlib submodule 2026-04-07 22:52:52 +03:00
LICENSE initial commit 2026-03-11 02:10:09 +03:00
Makefile update cljlib, rework namespace handling in identifiers 2026-05-12 00:36:32 +03:00
README.md rework keywords, custom destructuring, fix tests 2026-03-24 23:41:50 +03:00
TODO.org refactoring 2026-03-20 03:28:15 +03:00

ClojureFnl

A WIP Clojure-to-Fennel transpiler.

VERY WIP

MUCH POC

Goals

  • Run Clojure code defined in .cljf files on a Lua runtime.
  • Mix Clojure code with Fennel and full Lua ecosystem.
  • Access to C API via Lua's excellent C-FFI or LuaJIT

Non-goals

  • Provide full compatibility with JVM Clojure. Only as close as possible.
  • Full feature parity of Clojure's REPL capabilities. Fennel's REPL is far less advanced, and building Clojure-like REPL has to be a separate project.

Differences from Clojure

See the differences document.

Usage in existing project

  • Add this as a library to your Lua/Fennel application.
  • Install the searcher
  • Use require to load .cljf files.

Usage as a standalone language

ClojureFnl provides a script, like Fennel, that can be run interactively, giving you an alternative to Babashka when you need a fast-starting Clojure environment.

How it works

This library implements a recompiler approach that translates Clojure syntax into Fennel's syntax, and then uses Fennel to compile it to Lua. We do it this way because Fennel's AST is far easier to target than Lua, and Fennel already has a lot of specific cases handled when compiling a Lisp expression-based code into Lua statements with proper expression support. Fennel itself doesn't introduce any additional semantics atop of Lua, which makes it an ideal target.

However, this doesn't mean that this is a simple Clojure syntax to Lua transpiler.

ClojureFnl aims to keep most of the Clojure's semantics - lazy sequences, immutable collections, transducers, transients, and provide additional features that are possible to port to Lua, like protocols. This project is heavily based on a previous project fennel-cljlib, and a set of libraries made for it.

Contributing

If you love parsers and transpilers, read the contribution guide.