{"id":27636051,"url":"https://github.com/omdxp/fun","last_synced_at":"2026-04-06T20:00:55.890Z","repository":{"id":256727867,"uuid":"856234366","full_name":"omdxp/fun","owner":"omdxp","description":"Fun is a statically-typed language that transpiles to C, combining safety and performance with C's efficiency.","archived":false,"fork":false,"pushed_at":"2026-04-01T20:57:38.000Z","size":2857,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-02T04:38:09.007Z","etag":null,"topics":["c","transpiler","zig"],"latest_commit_sha":null,"homepage":"https://omdxp.github.io/fun","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/omdxp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-12T08:17:00.000Z","updated_at":"2026-04-01T20:53:18.000Z","dependencies_parsed_at":"2024-09-12T19:24:26.088Z","dependency_job_id":"472f21e8-9d02-4c2b-8a69-958452bdc123","html_url":"https://github.com/omdxp/fun","commit_stats":null,"previous_names":["omdxp/fun"],"tags_count":97,"template":false,"template_full_name":null,"purl":"pkg:github/omdxp/fun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omdxp%2Ffun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omdxp%2Ffun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omdxp%2Ffun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omdxp%2Ffun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omdxp","download_url":"https://codeload.github.com/omdxp/fun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omdxp%2Ffun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31487542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","transpiler","zig"],"created_at":"2025-04-23T20:32:29.636Z","updated_at":"2026-04-06T20:00:55.880Z","avatar_url":"https://github.com/omdxp.png","language":"Zig","readme":"\n# Fun Programming Language\n\n[![CI](https://img.shields.io/github/actions/workflow/status/omdxp/fun/ci-dev.yml?branch=main)](https://github.com/omdxp/fun/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n**Fun** is a statically-typed programming language that transpiles to C, designed for safety, performance, and simplicity. Written in Zig. Fun includes high-level defaults (`num`, `dec`) and low-level fixed/arbitrary-width numeric types (`i32`, `u64`, `f32`, `f64`, `iN`, `uN`).\n\n---\n\n## Table of Contents\n- [Fun Programming Language](#fun-programming-language)\n  - [Table of Contents](#table-of-contents)\n  - [Features](#features)\n  - [Installation](#installation)\n  - [Release installers (bundles)](#release-installers-bundles)\n  - [GitHub Actions](#github-actions)\n  - [CLI Usage](#cli-usage)\n    - [C Compiler Selection](#c-compiler-selection)\n      - [Windows notes](#windows-notes)\n  - [Quickstart](#quickstart)\n  - [Examples](#examples)\n  - [Documentation](#documentation)\n  - [Project Structure](#project-structure)\n  - [Contributing](#contributing)\n  - [Changelog](#changelog)\n  - [License](#license)\n  - [IDE / Language Server (fls)](#ide--language-server-fls)\n    - [VS Code](#vs-code)\n    - [Other Editors](#other-editors)\n    - [GitHub Syntax Highlighting](#github-syntax-highlighting)\n  - [Installation](#installation-1)\n    - [Prerequisites](#prerequisites)\n    - [Build from Source](#build-from-source)\n    - [Install from Release](#install-from-release)\n\n---\n\n## Features\n\n- Statically-typed, C-like performance\n- Rich numeric model (`num`/`dec`, fixed-width `i32`/`u64`, and arbitrary-width `iN`/`uN`)\n- Transpiles to readable C code\n- Simple, expressive syntax\n- Modular imports\n- Pattern matching (`fit` statement)\n- Type-safe variables and functions\n- CLI with multiple output and debug options\n- AST printing and analysis\n- Comprehensive error handling\n- Example and test suite\n\n## Installation\n\nRequires [Zig](https://ziglang.org/) (v0.14.0+ recommended).\n\n```bash\nzig build\n```\n\nThis will build the `fun` compiler in `zig-out/bin/fun`.\n\nTo install the compiler plus the Fun standard library files:\n\n```bash\nzig build install\n```\n\nThis installs:\n- `zig-out/bin/fun`\n- `zig-out/share/fun/stdlib/std/c/*.fn` (signature-only C-interop modules used for tooling)\n\nNotes:\n- `std.c.*` is the C-interop layer (signatures only). These modules describe external C APIs (e.g. `printf`) so the compiler and language server can typecheck and provide tooling.\n- `std.*` (without `.c`) is intended for Fun-native standard library modules written in Fun.\n\n## Release installers (bundles)\n\nRelease assets are packaged as install bundles (binary + `share/fun/` + an installer script).\n\nOn Windows, release assets are provided as both `.msi` installers and portable `.zip` archives.\nThe portable archive contains the same `fun-\u003ctarget\u003e/` layout (`bin/` + `share/fun/`) so you can unzip and run without installation.\nEach portable archive also includes `README-portable.txt` with Windows-specific quickstart notes.\n\nThe compiler discovers the standard library at runtime using, in order:\n- `FUN_STDLIB_DIR` (explicit override)\n- `\u003cexe\u003e/../share/fun` (installed layout)\n- common system locations (platform-dependent)\n\n## GitHub Actions\n\nUse the published setup action to install `fun` in CI:\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: omdxp/setup-fun@v1\n        with:\n          version: latest\n      - run: fun -version\n```\n\n## CLI Usage\n\n```\nUsage: fun -in \u003cinput_file\u003e [-out \u003coutput_file\u003e] [-no-exec] [-outf] [-ast] [-help]\n\nArguments:\n  -in      \u003cfile\u003e  Input file to compile (required)\n  -out     \u003cfile\u003e  Output file (optional, defaults to input filename with .c extension)\n  -no-exec         Disable automatic compilation and execution (optional, execution enabled by default)\n  -outf            Generate .c output file (optional, disabled by default)\n  -ast             Print AST nodes (optional, disabled by default)\n  -help            Show this help message\n```\n\n### C Compiler Selection\n\nBy default, `fun` tries platform compiler defaults unless `FUN_CC` is set:\n\n- Windows: `zig cc`, `clang`, `gcc`, `cl`\n- macOS/Linux: `zig cc`, `clang`, `gcc`, `cc`\n\nRelease installers on macOS/Linux set `FUN_CC=gcc` by default. The Windows MSI sets `FUN_CC` to use `cl` with a template command. The Windows portable `.zip` does not modify your environment. You can override the C compiler with environment variables:\n\n- `FUN_CC`: compiler command. If it includes `{src}` and `{out}`, it is treated as a full template.\n- `FUN_CC_ARGS`: extra arguments appended after the base command.\n\nExamples:\n\n- Use clang:\n  - `FUN_CC=clang`\n- Use zig cc explicitly:\n  - `FUN_CC=zig` and `FUN_CC_ARGS=\"cc\"`\n- Use a template with explicit placeholders:\n  - `FUN_CC=\"clang -O2 {src} -o {out}\"`\n\n#### Windows notes\n\nIf you use `cl`, run `fun` from **Developer PowerShell for Visual Studio** (or after `VsDevCmd.bat`) so MSVC environment variables are initialized.\n\nRecommended stable setup on Windows:\n\n```powershell\n$env:FUN_CC = \"zig\"\n$env:FUN_CC_ARGS = \"cc\"\n```\n\nUse `cl` explicitly only when your VS toolchain shell is active:\n\n```powershell\n$env:FUN_CC = \"cl /nologo /Fe{out} {src}\"\n$env:FUN_CC_ARGS = \"\"\n```\n\nIf `cl` compiles but runtime output looks wrong on your system/toolset, switch back to `zig cc`.\n\n## Quickstart\n\nWrite your first program in `hello.fn`:\n\n```fun\nimp std.c.io;\n\nfun main(str[] args) {\n  printf(\"Hello, World!\\n\");\n}\n```\n\nCompile and run:\n\n```bash\nzig build\n./zig-out/bin/fun -in hello.fn\n```\n\n## Examples\n\nExplore the [`examples/`](examples/) directory for more:\n- Basic: [`test.fn`](examples/test.fn)\n- Advanced: [`advanced/custom_functions.fn`](examples/advanced/custom_functions.fn)\n- Imports: [`imports/main.fn`](examples/imports/main.fn)\n- Imports (parent traversal `....`): [`imports/parent_traversal_2up/nested/level1/main.fn`](examples/imports/parent_traversal_2up/nested/level1/main.fn)\n- Error cases: [`error_cases/`](examples/error_cases/)\n\n## Documentation\n\n- Language overview: [docs/language.md](docs/language.md)\n- Full reference: [docs/reference.md](docs/reference.md)\n- Channel/runtime conformance matrix and backend thresholds: [docs/channel-runtime-conformance.md](docs/channel-runtime-conformance.md)\n\n## Project Structure\n\n- `cmd/` — CLI entrypoint\n- `modules/` — Core compiler modules (lexer, parser, codegen, semantics, utils, etc.)\n- `examples/` — Example programs\n- `tests/` — Test suite\n- `build.zig` — Zig build script\n\n## Contributing\n\nContributions are welcome! Please open issues or pull requests. See [CONTRIBUTING.md](CONTRIBUTING.md) if available.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for release notes and development history.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## IDE / Language Server (fls)\n\nThis repo includes a work-in-progress language server called `fls`.\n\n- Build: `zig build` (installs `fls` alongside `fun`)\n- The server speaks LSP over stdio and currently supports:\n  - Diagnostics (via `fun -no-exec`)\n  - Formatting (via `fun -fmt -no-exec`)\n\n### VS Code\n\nThere is a minimal VS Code extension scaffold in [editors/vscode](editors/vscode).\n\n- Build `fun` + `fls` first (`zig build`)\n- Then open `editors/vscode` in VS Code and follow its README.\n\n### Other Editors\n\nSee [editors/README.md](editors/README.md) for Vim/Neovim, Emacs, JetBrains, and Sublime setup.\n\n### GitHub Syntax Highlighting\n\nThis repo maps `.fn` files to Zig highlighting on GitHub via [/.gitattributes](.gitattributes).\nFor native Fun highlighting, submit a Fun definition + TextMate grammar to GitHub Linguist.\n\n## Installation\n\n### Prerequisites\n\n- [Zig](https://ziglang.org/download/) (the one defined in [build.zig.zon](build.zig.zon))\n- Windows, Linux, or macOS\n\n### Build from Source\n\nClone the repository and build using Zig:\n\n```sh\ngit clone https://github.com/omdxp/fun.git\ncd fun\nzig build\n```\n\n### Install from Release\n\nPre-built installers and binaries are available for each release. See [Release installers (bundles)](#release-installers-bundles).\n\n\n\n\n\n\n\n","funding_links":[],"categories":["Systems Programming"],"sub_categories":["Compilers and Interpreters"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomdxp%2Ffun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomdxp%2Ffun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomdxp%2Ffun/lists"}