Fun Programming Language
A statically typed programming language that transpiles to C, built for predictable performance, straightforward tooling, and portable deployment.
Language Guide
·
Reference
·
Examples
·
VS Code
## Overview
Fun is a compiled language implemented in Zig that lowers Fun source code to readable C. The project focuses on a compact language surface, strong static typing, practical concurrency, and an editor-friendly toolchain built around formatting, diagnostics, and language-server support.
The language provides high-level default numerics (`num`, `dec`), fixed-width scalar types (`i32`, `u64`, `f32`, `f64`), and arbitrary-width integers (`iN`, `uN`) so the same codebase can target ergonomic application code and lower-level systems work.
## Why Fun
- Predictable compilation model: Fun compiles through C, making generated output inspectable and portable across common platform toolchains.
- Practical type system: the language combines simple defaults with low-level numeric control when exact layout or width matters.
- Built-in concurrency primitives: virtual threads, channels, async/await, and task coordination are first-class parts of the language and standard library.
- Tooling-first workflow: formatting, diagnostics, a language server, and editor integrations are part of the day-to-day development experience.
- Compact standard library: the core library covers collections, filesystem, networking, serialization, synchronization, and C interop signatures.
## Core Capabilities
- Static typing with explicit, readable syntax
- Transpilation to C with debug-friendly source mapping
- Pattern matching via `fit`
- Data-carrying enums and generic compounds
- Default parameter values
- Virtual-thread concurrency with `fork`
- Standard-library support for channels, tasks, threads, filesystem access, JSON, TOML, networking, and more
- CLI tooling for formatting, diagnostics, AST inspection, and code generation
## Installation
### Prerequisites
- [Zig](https://ziglang.org/download/) matching the version declared in [build.zig.zon](build.zig.zon)
- macOS, Linux, or Windows
### Build From Source
```sh
git clone https://github.com/omdxp/fun.git
cd fun
zig build
```
This produces the compiler and language server in `zig-out/bin/`.
To install the compiler together with the standard library layout used by the runtime and editor tooling:
```sh
zig build install
```
### Release Bundles
Release assets are published as install bundles containing the compiler, the standard library under `share/fun/`, and platform-specific install assets.
- Windows releases are available as `.msi` installers and portable `.zip` archives.
- Portable archives preserve the same `bin/` and `share/fun/` layout as an installed release.
- Windows portable packages include `README-portable.txt` with platform-specific startup notes.
At runtime, the compiler discovers the standard library in this order:
1. `FUN_STDLIB_DIR`
2. `