f90c is a single executable Fortran 90 compiler written in Rust. It can compile, link, and run Fortran 90 sources, supporting object files, optimizations, warnings, and multiple subcommands.
Download the precompiled binary from the GitHub releases page and place it in a directory included in your PATH.
The general command structure is:
f90c [subcommand] [links.o (.obj)] [inputs.f90] [options]If no subcommand is provided, all .f90 inputs are compiled into an executable, optionally linking with .o (.obj) object files.
| Subcommand | Description |
|---|---|
lex |
Dump tokens of a .f90 source file |
parse |
Dump AST of a .f90 source file |
check |
Run semantic checks only |
build |
Compile a .f90 source into an executable |
link |
Link .o (.obj) object files and .f90 sources into an executable |
emitobj |
Emit a .f90 source as a .o (.obj) object file |
run |
Parse, check, and execute a .f90 source file via JIT |
help |
Show help for f90c or subcommands |
| Flag | Description |
|---|---|
-o, --out <path> |
Output executable or object path. Defaults derived from the first source |
--Wall |
Enable all warnings |
--Werror |
Treat warnings as errors |
--lto |
Enable Link Time Optimization (LTO) for better performance |
-O, --opt-level <LEVEL> |
Set optimization level: 0, 1, 2, 3, s, z, S, Z (default 2) |
-q, --quiet |
Suppress all output except errors |
-h, --help |
Show help message |
-v, --version |
Show version information |
f90c lex input.f90input.f90– Input Fortran 90 source file
f90c parse input.f90input.f90– Input Fortran 90 source file
f90c check input.f90input.f90– Input Fortran 90 source file
Compile a .f90 source into an executable.
f90c build input.f90 [options]Options:
-o,--out <path>– Output path for the executable--run– Run after build
Link .o (.obj) object files and .f90 sources into an executable.
f90c link links.o inputs.f90 [options]Options:
-o,--out <path>– Output executable path
Sources will be compiled first into
.o(.obj) object files if included
Emit a .f90 source as a .o (.obj) object file to a specific path.
f90c emitobj input.f90 -o output.oinput.f90– Input Fortran 90 source fileoutput.o– Output object file path (.objon Windows)
Parse, check, and execute a .f90 source file via JIT.
f90c run input.f90input.f90– Input Fortran 90 source file
Show help for f90c or subcommands.
f90c helpCompile a single .f90 source into an executable:
f90c main.f90This produces an executable derived from the first source name.
Compile multiple .f90 sources directly:
f90c main.f90 file1.f90 file2.f90Each file is compiled separately into its own executable.
This does not link them together.
Build reusable object files (modules only, no program):
f90c lib1.f90
f90c utils.f90This produces lib1.o (lib1.obj) and utils.o (utils.obj).
Link a main program with object files:
f90c main.f90 lib1.o utils.oThis compiles main.f90 and links it with the object files into a single executable.
Build an executable with a custom name:
f90c build main.f90 -o programThis compiles main.f90 into an executable named program.
Enable all warnings and treat them as errors:
f90c main.f90 --Wall --WerrorRun a .f90 program with JIT:
f90c run main.f90This project is licensed under the GPLv3 License.