omdxp/fun
fun is a statically-typed language that transpiles to C, combining safety and performance with C's efficiency.
A statically-typed programming language that transpiles to C, designed for safety, performance, and leveraging the power of C. Written in Zig.
fit
statementRequires Zig (v0.14.0+ recommended).
zig build
This will build the fun
compiler in zig-out/bin/fun
.
Usage: fun -in <input_file> [-out <output_file>] [-no-exec] [-outf] [-ast] [-help]
Arguments:
-in <file> Input file to compile (required)
-out <file> Output file (optional, defaults to input filename with .c extension)
-no-exec Disable automatic compilation and execution (optional, execution enabled by default)
-outf Generate .c output file (optional, disabled by default)
-ast Print AST nodes (optional, disabled by default)
-help Show this help message
Write your first program in hello.fn
:
imp std.io;
fun main(str[] args) {
printf("Hello, World!\n");
}
Compile and run:
zig build
./zig-out/bin/fun -in hello.fn
Explore the examples/
directory for more:
test.fn
advanced/custom_functions.fn
imports/main.fn
error_cases/
cmd/
— CLI entrypointmodules/
— Core compiler modules (lexer, parser, codegen, semantics, utils, etc.)examples/
— Example programstests/
— Test suitebuild.zig
— Zig build scriptContributions are welcome! Please open issues or pull requests. See CONTRIBUTING.md if available.
See CHANGELOG.md for release notes and development history.
This project is licensed under the MIT License. See the LICENSE file for details.