Fun (https://fun-lang.xyz)
Fun is a highly strict programming language, but also highly simple. It looks like Python (My favorite language), but there are differences.
Influenced by Bash, C, Go, Lua, Python, and Rust (Most influences came from linked languages).
Fun is and will ever be 100% free under the terms of the Apache-2.0 License.
- Simplicity
- Consistency
- Joy in coding
- Fun!
- JSON support builtin using json-c (optional) ☑
- ODBC support builtin for flexible database connectivity using unixODBC (optional) ☐
- PC/SC smart card support builtin using PCSC lite (optional) ☑
- PCRE2 support builtin for Perl-Compatible Regular Expressions (optional) ☑
- SQLite support builtin (optional) ☐
- Tk support builtin for GUI application development (optional) ☐
☑ = Done / ☐ = Planned or in progress.
- Dynamic and optionally statically typed
- Type safety
- Written in C (C99) and Fun
- Internal libs are written with no_camel_case even when written in Fun, except class names
- Only a minimal function set is written in C, and most other core functions and libraries are implemented in Fun
Fun is a programming language built on a simple idea: Coding should be enjoyable, elegant, and consistent.
- Fun is Fun
Programming should spark creativity, not frustration. Code in Fun feels light, playful, and rewarding. - Fun Uses Nothing
Minimalism is power. No unnecessary features, no endless syntax variations, no formatting debates. Just clean, uniform code. - Indentation is Truth
Two spaces, always. No tabs, no four-space wars. Code should look the same everywhere, from your laptop to /usr/bin/fun. - One Way to Do It
No clutter, no 15 ways of writing the same thing. Simplicity means clarity. - Hackable by Nature
Fun should be small and embeddable, like Lua. Easy to understand, extend, and tinker with — true to the hacker spirit. - Beautiful Defaults
A language that doesn’t need linters, formatters, or style guides. Beauty is built in.
Fun is not about being the fastest or the most feature-rich. It’s about sharing joy in coding. The community should be:
- Respectful
- Curious
- Creative
Like the name says: Fun Unites Nerds.
Please visit the Fun Community Page to get in touch.
A language that feels like home for developers who:
- Love minimal, elegant tools
- Believe consistency is freedom
- Want to write code that looks good and feels good
Fun may not change the world — but it will make programming a little more fun.
I am writing documentation only actually, but this is work in progress, since debugging and bug fixing includes this task.
Current documentation is only found in the Fun Handbook.
In the examples/ directory should be an example of most Fun features.
A complete API documentation will follow.
This section is a work in progress... Please excuse the lack of more information. There are daily updates here.
- Every commit message must contain the version at the end in the following format (1.2.3)
- Every commit requires a version incrementation in CMakeLists.txt before committing. Documentation updates do not increment the version but must contain the current version in each commit message.
- Version numbering follows "Semantic Versioning 2.0.0"
- GNU/Linux (Arch/Artix, Debian) using GCC and the GNU C library (glibc)
- GNU/Linux (Alpine) using GCC and the musl libc
- FreeBSD using Clang and the BSD libc
- Windows using Cygwin and GCC.
- macOS, NetBSD, OpenBSD, etc. should fully work, but I don't know. I do not use these systems actually. You wanna try and report?
Everything... ;) No, a lot of stuff works already, but only a tiny set of functionality is available in the Fun programming language. It grows from day to day...
Linux/UNIX only covered here for now.
Clone repository:
git clone https://git.xw3.org/fun/fun.gitChange directory:
cd funBuild:
# Note: Every -D flag must be of the form NAME=VALUE (e.g., -DFUN_WITH_REPL=ON)
cmake -S . -B build -DFUN_DEBUG=OFF -DFUN_WITH_PCSC=OFF -DFUN_WITH_REPL=ON -DFUN_WITH_JSON=ON
cmake --build build --target funCMake options you can toggle (all require NAME=VALUE):
- FUN_DEBUG=ON|OFF — verbose debug logging in the VM (default OFF)
- FUN_WITH_REPL=ON|OFF — enable building the interactive REPL (default ON)
- FUN_WITH_PCSC=ON|OFF — enable PC/SC smart card support (default OFF)
- FUN_WITH_JSON=ON|OFF — enable JSON support via json-c (default OFF)
That's it! For testing it, run:
FUN_LIB_DIR="$(pwd)/lib" ./build/fun ./demo.funTo see what's going on, run:
FUN_LIB_DIR="$(pwd)/lib" ./build/fun --trace ./demo.funTo switch into the REPL after an error, run:
FUN_LIB_DIR="$(pwd)/lib" ./build/fun --repl-on-error --trace ./demo.funBoth --repl-on-error and --trace are optional but can always be combined. To get more debug information, you need to build Fun with -DFUN_DEBUG=ON.
To directly run the REPL, you have to run:
FUN_LIB_DIR="$(pwd)/lib" ./build/funBut be sure to build Fun with -DFUN_WITH_REPL=ON.
Tip: If you saw an error like this when configuring with CMake:
CMake Error: Parse error in command line argument: FUN_WITH_JSON Should be: VAR:type=value
it means a -D flag was passed without a value. Always specify options as -DNAME=VALUE, for example:
-DFUN_WITH_JSON=ON
Johannes Findeisen [email protected]