Fennel
lastmod 2025-04-15created 2025-04-151 edits
A programming language that runs on the Lua runtime
About
- Fennel is a programming language that runs on the Lua runtime
- Lua is a simple yet powerful programming language that integrates easily into other programs, giving users the ability to reprogram them
- Fennel makes up for Lua's shortcomings, offering a clearer, less error-prone alternative
- Fennel uses Lisp-family syntax, reducing syntactic complexity and improving code readability
- Fennel offers improvements over Lua in variable reassignment, table notation, function argument checking, and more
What is Fennel?
- Fennel is a programming language that runs on the Lua runtime
- Lua is a simple yet powerful language that integrates easily into other programs, giving users the ability to reprogram them
- Fennel makes up for Lua's shortcomings, offering a clearer, less error-prone alternative
Advantages of Lua
- Lua is a small, fast language: about 19,000 lines of C code that compile to 278kb
- Offers powerful features while keeping conceptual simplicity
- Integrates easily into other programs, letting users reprogram those programs
Key features of Fennel
- Fennel uses Lisp-family syntax, reducing syntactic complexity and improving code readability
- Everything is treated as an expression, so there is no ambiguity about operator precedence or early returns
- Variables: makes global variables harder to use to reduce mistakes, and requires var for variable reassignment to improve clarity
Tables and loops
- Fennel improves table notation, distinguishing arrays from key/value tables
- Uses for and each in loops to provide clear syntax
Functions and other features
- Fennel supports function argument checking, raising an error when arguments are missing
- Supports destructuring and pattern matching, allowing more declarative conditionals
- Includes a macro system, making it easy to extend with new syntactic forms