- C3 91.5%
- Shell 7.6%
- C++ 0.2%
- Python 0.2%
- C 0.2%
- Other 0.2%
| docs | ||
| resources | ||
| scripts | ||
| src | ||
| test | ||
| .gitignore | ||
| LICENSE | ||
| project.json | ||
| README.md | ||
ccc — Compiler Command Center
ccc is a smart compiler wrapper that automatically selects the right compiler or interpreter for your source files based on their extension or shebang line.
Stop remembering gcc, clang++, rustc, go build, python3, node, and dozens of other commands — just use ccc (or c if you prefer a short alias).
Features
- Auto‑detection – picks the correct toolchain from file extension or
#!shebang. - Unified interface – one command for C, C++, Rust, Go, Nim, C3, Zig, Python, JavaScript, TypeScript, Java, Mojo, D, Ruby, Lua, Haskell, and more.
- Run mode – execute scripts directly with
ccc run(e.g.,ccc run main.py). - Compiler caching – speeds up repeated compilations (stored in
~/.config/ccc/runcache/). - Customizable – override any compiler/interpreter via environment variables.
- Lightweight – written in C3, no external dependencies beyond the language runtime.
Installation
git clone https://github.com/0xA672/ccc.git
cd ccc
c3c build
mkdir -p ~/.local/bin
ln -sf $(pwd)/build/ccc ~/.local/bin/ccc
ln -sf ~/.local/bin/ccc ~/.local/bin/c # short alias
Requirements: C3 compiler ≥ 0.7.x
Usage
# Basic auto‑detect and compile
ccc main.c # → gcc / clang
ccc main.cpp # → g++ / clang++
ccc main.rs # → rustc
ccc main.go # → go build
ccc main.nim # → nim c
ccc main.c3 # → c3c build
ccc main.zig # → zig build / run
ccc main.py # → python3
ccc main.js # → node
ccc main.ts # → deno
ccc main.java # → javac + java
ccc main.mojo # → mojo
ccc main.d # → dmd / ldc2
ccc main.rb # → ruby
ccc main.lua # → lua
ccc main.hs # → ghc
# Pass extra arguments
ccc main.c -O2 -Wall
# Run a script directly (execute, don't just compile)
ccc run main.py --arg1 --arg2
ccc run main.js --verbose
ccc run main.go
# Force a specific language (ignore extension)
ccc -x c++ file.txt
ccc run -x python script.txt
# Detect language only (no execution)
ccc --detect main.go
# List all supported languages
ccc --list
# Suppress diagnostic output
ccc --quiet main.c
# Show help
ccc --help
ccc --version
Supported Languages
| Language | Extensions | Compiler / Interpreter | Run mode |
|---|---|---|---|
| C | .c |
gcc, clang, cc, zig cc |
compile + run |
| C++ | .cpp .cc .cxx .hpp |
g++, clang++, c++ |
vix (if available) or compile + run |
| Rust | .rs |
rustc |
compile + run |
| Go | .go |
go build |
go run |
| Nim | .nim |
nim c |
nim run |
| C3 | .c3 |
c3c |
c3c run |
| Zig | .zig |
zig |
zig run |
| Python | .py |
python3 |
python3 |
| JavaScript | .js |
node, deno, bun |
node / deno / bun |
| TypeScript | .ts |
tsc (compile) |
deno / bun |
| Java | .java |
javac |
java -cp |
| Mojo | .mojo |
mojo |
mojo run |
| D | .d |
dmd, ldc2, gdc |
compile + run |
| Ruby | .rb |
ruby |
ruby |
| Lua | .lua |
lua |
lua |
| Haskell | .hs |
ghc |
ghc (compile + run) |
Note: For languages marked “compile + run”,
cccfirst compiles the source to an executable and then runs it. For interpreted languages, it invokes the interpreter directly. Java is treated specially:ccccompiles withjavac -d <cache>and runs withjava -cp.
Language Override (-x)
Use -x <lang> to force a specific language, bypassing extension and shebang detection. Supported identifiers:
c,c++,cpp,cxx,ccrust,rsgonimc3zigpython,pyjs,javascript,nodets,typescript,denojavamojod,dlangruby,rbluahaskell,hs
Example:
ccc -x c++ myfile.txt – compiles myfile.txt as C++.
Environment Variables
Override the path to a specific compiler/interpreter by setting the corresponding variable.
If set, ccc will use that exact executable (must be in $PATH or an absolute path).
| Variable | Targets |
|---|---|
CC |
C |
CXX |
C++ |
RUSTC |
Rust |
GO |
Go |
NIMC |
Nim |
C3C |
C3 |
ZIG |
Zig |
PYTHON |
Python |
NODE |
JavaScript |
TSC |
TypeScript |
JAVAC |
Java |
MOJO |
Mojo |
DC |
D |
RUBY |
Ruby |
LUA |
Lua |
GHC |
Haskell |
Example:
CC=clang-16 ccc main.c – forces use of clang-16.
Cache System
ccc stores compiled binaries in a cache directory (~/.config/ccc/runcache/) to speed up repeated compilations.
The cache key is derived from the source file path and the compiler name.
If the source file’s modification time hasn’t changed, the cached binary is reused.
To clear the cache manually, delete ~/.config/ccc/runcache/.
How It Works
- Extension detection – The file extension is looked up in a built‑in table.
- Shebang fallback – If the extension is unknown, the first line is parsed for
#!. - Compiler/runtime lookup –
cccsearches$PATHfor the appropriate executable. - Command construction – It builds the correct command line (with caching where applicable).
- Execution – The command is spawned, inheriting standard I/O and environment.
Building from Source
git clone https://github.com/0xA672/ccc.git
cd ccc
c3c build
The executable will be placed in build/ccc.
Contributing
Contributions are welcome! To add support for a new language:
- Add a new member to the
Languageenum. - Extend the
_COMPSand_RUNSarrays with compiler/runtime candidates. - Add file extensions to
_EXT_STRS/_EXT_LANGS. - Add aliases to
_ALIAS_STRS/_ALIAS_LANGS. - Update the parallel metadata arrays (
_LANG_NAME,_LANG_ENV, etc.). - Adjust the
compile_and_runandexec_cmdlogic if special handling is needed.
Please ensure the code compiles with the latest C3 compiler and passes basic tests.
License
MIT — see LICENSE for details.
Happy coding with ccc!