1 unstable release
Uses new Rust 2024
| 0.1.0 | Feb 4, 2026 |
|---|
#1543 in Programming languages
Used in fastc-lsp
355KB
9K
SLoC
FastC
A safe C-like language that compiles to C11.
FastC is a source-to-source transpiler that emits standard C11 code. It removes common C footguns while keeping the C toolchain, ABI, and performance model intact.
Features
- Safe by default - Null safety with
opt(T), bounds-checked arrays, explicit unsafe blocks - C11 output - Works with any C compiler (gcc, clang, MSVC)
- Zero runtime overhead - No garbage collector, no hidden allocations
- C interop - Call C functions, expose APIs to C, use existing libraries
Installation
# Build from source
cargo install --path .
# Or build the workspace
cargo build --release
Usage
# Compile FastC to C
fastc compile input.fc -o output.c
# Generate header file
fastc compile input.fc -o output.c --emit-header
# Build and compile to executable
fastc build --cc
# Build and run
fastc run
Example
// hello.fc
fn main() -> i32 {
return 0;
}
fastc compile hello.fc -o hello.c
cc -I /path/to/fastc/runtime hello.c -o hello
./hello
Documentation
License
This project is licensed under the MIT License.
Dependencies
~22MB
~444K SLoC