133 lines
5.8 KiB
Markdown
133 lines
5.8 KiB
Markdown
# Fun ([https://fun-lang.xyz](https://fun-lang.xyz))
|
||
|
||
## What is Fun?
|
||
|
||
Fun is a small, strict, and simple programming language that runs on a compact stack-based virtual machine. The C core is intentionally minimal; most functionality and standard libraries are implemented in Fun itself. The language emphasizes simplicity, consistency, and joy in coding.
|
||
|
||
Fun is an experiment, just for fun, but Fun works!
|
||
|
||
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](https://www.gnu.org/software/bash/)**, **[C](https://en.wikipedia.org/wiki/The_C_Programming_Language)**, **[Lua](https://www.lua.org/)**, PHP, **[Python](https://www.python.org/)**, 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](https://opensource.org/license/apache-2-0).
|
||
|
||
## Idea
|
||
|
||
- Simplicity
|
||
- Consistency
|
||
- Simple to extend
|
||
- Hackable
|
||
- Joy in coding
|
||
- Fun!
|
||
|
||
## Characteristics
|
||
|
||
- 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
|
||
|
||
## The Fun Manifesto
|
||
|
||
Fun is a programming language built on a simple idea:
|
||
Coding should be enjoyable, elegant, and consistent.
|
||
|
||
### Philosophy
|
||
|
||
- **Fun is Fun**<br>
|
||
Programming should spark creativity, not frustration. Code in Fun feels light, playful, and rewarding.
|
||
- **Fun Uses Nothing**<br>
|
||
Minimalism is power. No unnecessary features, no endless syntax variations, no formatting debates. Just clean, uniform code.
|
||
- **Indentation is Truth**<br>
|
||
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**<br>
|
||
No clutter, no 15 ways of writing the same thing. Simplicity means clarity.
|
||
- **Hackable by Nature**<br>
|
||
Fun should be small and embeddable, like Lua. Easy to understand, extend, and tinker with — true to the hacker spirit.
|
||
- **Beautiful Defaults**<br>
|
||
A language that doesn’t need linters, formatters, or style guides. Beauty is built in.
|
||
|
||
## The Community
|
||
|
||
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
|
||
- Open for everyone
|
||
|
||
Like the name says: Fun Unites Nerds.
|
||
|
||
Please visit the [Fun Community Page](https://fun-lang.xyz/community/) to get in touch.
|
||
|
||
## The Goal
|
||
|
||
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.
|
||
|
||
## Features
|
||
|
||
### Core
|
||
|
||
- functions/classes/objects
|
||
- if/else if/else
|
||
- try/catch/finally
|
||
|
||
And much more...! Look at the specs in [Spec](./spec/) for more detailed information.
|
||
|
||
### Lib (./lib/)
|
||
|
||
See [./lib/](https://git.xw3.org/fun/fun/src/branch/main/lib) for what the standard library provides.
|
||
|
||
### Optional extensions (build-time selectable / only testing this on Linux actually):
|
||
|
||
- [CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface) support builtin using [kcgi](https://kristaps.bsd.lv/kcgi/) (optional) — see [docs](./web/documentation/extensions/kcgi/kcgi.md) ☑
|
||
- [cURL (libcurl)](./web/documentation/extensions/curl/curl.md) (optional) ☑
|
||
- [INI (iniparser)](./web/documentation/extensions/ini/ini.md) (optional) ☑
|
||
- [JSON (json-c)](./web/documentation/extensions/json/json.md) (optional) ☑
|
||
- [PCRE2](./web/documentation/extensions/pcre2/pcre2.md) (optional) ☑
|
||
- [PCSC (smart cards)](./web/documentation/extensions/pcsc/pcsc.md) (optional) ☑
|
||
- [OpenSSL](./web/documentation/extensions/openssl/openssl.md) (optional) ☑
|
||
- [SQLite](./web/documentation/extensions/sqlite/sqlite.md) (optional) ☑
|
||
- [XML (libxml2)](./web/documentation/extensions/xml2/xml2.md) (optional) ☑
|
||
|
||
☑ = Done (or basics implemented) / ☐ = Planned or in progress.
|
||
|
||
Note: Not all of the above features will be implemented. Those who are marked "Done" will probaly remain in Fun, but I don't know actually... ;)
|
||
|
||
There are some libs written in Fun available in the [./lib/](https://git.xw3.org/fun/fun/src/branch/main/lib) diretory. In the future most Fun enhancements should be written in Fun itself.
|
||
|
||
### OpenSSL quickstart (MD5)
|
||
|
||
See the dedicated page: [./web/documentation/extensions/openssl/](./web/documentation/extensions/openssl/openssl.md)
|
||
|
||
## Documentation
|
||
|
||
Looking for docs? Start here:
|
||
|
||
- Local documentation index: [./web/documentation/documenatation.md](./web/documentation/documentation.md)
|
||
- Handbook: [./web/documentation/handbook/handbook.md](./web/documentation/handbook/handbook.md)
|
||
- Types overview: [./web/documentation/types/types.md](./web/documentation/types/types.md)
|
||
- REPL guide: [./web/documentation/repl/repl.md](./web/documentation/repl/repl.md)
|
||
- Testing: [./web/documentation/testing/testing.md](./web/documentation/testing/testing.md)
|
||
- Troubleshooting: [./web/documentation/troubleshooting/troubleshooting.md](./web/documentation/troubleshooting/troubleshooting.md)
|
||
|
||
Additional references:
|
||
|
||
- Specification: [./web/documentation/spec/v0.4.md](./web/documentation/spec/v0.4.md) (work in progress)
|
||
- Changelog: [CHANGELOG.md](./CHANGELOG.md)
|
||
- Examples demonstrating most features: [./examples/](./examples/)
|
||
- Internals and VM opcodes live in [./src/](./src/) (see [./src/vm/](./src/vm) for opcode implementations)
|
||
|
||
Note: The project is evolving; some documents may lag behind. The docs index in [./web/documentation/documenatation.md](./web/documentation/documentation.md) is the most up‑to‑date entry point.
|
||
|
||
## Author
|
||
|
||
Johannes Findeisen - <you@hanez.org>
|