- Fennel 99.6%
- Makefile 0.3%
| src | ||
| tasks | ||
| test | ||
| .fennel-test | ||
| .gitignore | ||
| deps.fnl | ||
| DIFFERENCES.md | ||
| flsproject.fnl | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
| TODO.org | ||
ClojureFnl
A WIP Clojure-to-Fennel transpiler.
VERY WIP
MUCH POC
Goals
- Run Clojure code defined in
.cljffiles 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
requireto load.cljffiles.
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.