Grynz is a modular, universal compiler designed to compile multiple programming languages with a single command-line interface. The goal is to provide a seamless experience for developers by detecting the language of a given source file and compiling it using the appropriate compiler, handling project structures and dependencies where necessary.
Grynz is in its early development stage and currently supports the following languages:
C (via
gcc
)C++ (via
g++
)C++ (via
elixir
project support coming soon)Erlang (via
erl
, rebar3 support coming soon)Go (via
go build
)Java (via
javac
andjava
for execution)JavaScript (via
node
for execution, andpkg
for binary compilation)Kotlin (via
kotlinc
for compilation, andjava
for execution)Python (via
python
for execution, andNuitka
for binary compilation, although not recommended)Rust (via
rustc
)TypeScript (via
tsc
for compilation to JavaScript, andnode
for execution)Zig (via
zig build-exe
andzig run
to compile and output instantly)
- Detects file type based on extension and invokes the appropriate compiler.
- Supports specifying an output directory using the
--out
flag. - Handles compilation errors and outputs relevant messages.
- Supports running Java programs with package handling.
- Supports
java -cp bin Main
format for running compiled Java files. - Supports package-based execution:
java -cp bin javaFiles.Main
.
- Execution: Python scripts can be run directly using
grynz run script.py
. - Binary Compilation:
- Grynz supports compiling Python scripts into standalone binaries using Nuitka.
⚠️ Warning: Python does not natively compile to binaries. Nuitka compilation is optional and may not be efficient for all use cases.
- JavaScript Execution: JavaScript files can be run directly using
grynz run script.js
. - JavaScript Binary Compilation:
- Grynz supports compiling JavaScript files into standalone
.exe
binaries using pkg. ⚠️ Warning: Usingpkg
will installnode_18
on your system, regardless of the Node.js version you currently have installed.
- Grynz supports compiling JavaScript files into standalone
- TypeScript Execution: TypeScript files are first compiled to JavaScript using
tsc
, and the resulting JavaScript file can be executed usingnode
. - TypeScript Binary Compilation:
- TypeScript does not natively compile to
.exe
files. If you want to create a binary, you must first compile the TypeScript file to JavaScript usingtsc
, and then usepkg
to compile the JavaScript file into a binary. - Both steps (TypeScript to JavaScript, and JavaScript to binary) can be handled by Grynz.
- TypeScript does not natively compile to
- Ensures uniformity by checking for file existence before attempting compilation or execution.
- Uses modular language-specific files (
c.zig
,cpp.zig
,java.zig
, etc.) for handling compilation logic per language.
grynz build <file> [--out <output_dir>]
Example:
grynz build main.cpp --out ./bin
grynz run Main --out ./bin/javaFiles
For package-based execution:
grynz run javaFiles.Main --out ./bin
- 📂 Project Structure Detection:
- Detect
Cargo.toml
for Rust projects. - Detect Go modules for Go projects.
- Extend support for Java Maven/Gradle structures.
- Detect
- 🔧 Compiler Auto-Installation:
- If a required compiler is missing, prompt the user to install it.
- 🌍 More Language Support:
- Plan to add support for C#, Nim, Erlang, Elixir, Gleam etc.
- ⚙️ More Advanced Execution Handling:
- Support executing compiled C/C++/Rust binaries directly.
- Support running scripts (JavaScript, TypeScript, etc) in future versions.
This project is still in early development, and contributions are welcome. If you have suggestions, bug reports, or feature requests, feel free to open an issue or contribute via pull requests.
Grynz is licensed under the CC BY-NC-ND 4.0 license, meaning you cannot fork, modify, or use it commercially.
However, contributions are welcome! See the LICENSE file for details.