4 ms·
Similarly, Fennel [1] is a Lisp which compiles to Lua, and Lua is well supported in both C++ [2] and Rust [3]. Fennel’s a very reasonable option for delivering
by atweiden 5y ago
Similarly, Fennel [1] is a Lisp which compiles to Lua, and Lua is well supported in both C++ [2] and Rust [3]. Fennel’s a very reasonable option for delivering S-expression based user interactivity — e.g. REPLs and scriptable config [4].
[1]: https://fennel-lang.org/ https://fennel-lang.org/
[2]: https://github.com/ThePhD/sol2 https://github.com/ThePhD/sol2
[3]: https://github.com/amethyst/rlua https://github.com/amethyst/rlua
[4]: https://git.sr.ht/~ioiojo/include-fnl https://git.sr.ht/~ioiojo/include-fnl
- alpaca128 5y agoThis year I experimented a little with a Lisp transpiling to Lua and it was really surprising to me how well Lua fits this purpose. It can treat e.g. if statements as expressions and supports higher order functions as well as tail call optimisation, so mostly you can just map S-Expressions and a couple other basic features 1:1 to Lua code, and while it might not be super readable it will just work.
- atweiden 5y agoFennel combines the simplest general programming language (Lua) with the simplest syntax (homoiconicity). The result is like a Lisp without all the esoterica. Embedding Fennel in Rust allows you to ship user-facing macros written in Fennel without users having to setup a Lua environment beforehand (e.g. [1]). [1]: https://git.sr.ht/~ioiojo/kiwi/tree/master/item/tests/data/complex/cfg/pantry/init.fnl https://git.sr.ht/~ioiojo/kiwi/tree/master/item/tests/data/c...
- dasyatidprime 5y agoLua is very Scheme-like in its compactness and cohesion, but with the table as the fundamental compound data type instead of pairs and vectors. It's also a statement/expression language like Python, rather than just an expression language like a Lisp would be.
- fmakunbound 5y agoThe break loop example in the article (^C and continue etc.) probably won't work with these minor also-Lisps.