nim

programming language compiler

TLDR

Compile to executable
$ nim c [program.nim]
Compile and run
$ nim c -r [program.nim]
Release build
$ nim c -d:release [program.nim]
Generate C source without linking
$ nim c --compileOnly [program.nim]
Compile to JavaScript
$ nim js [program.nim]
Compile to C++
$ nim cpp [program.nim]
Check syntax and semantics
$ nim check [program.nim]
Generate HTML documentation
$ nim doc [program.nim]

SYNOPSIS

nim [command] [options] file

DESCRIPTION

nim is the Nim programming language compiler. It compiles to C, JavaScript, and other backends.The tool produces efficient executables. Features Python-like syntax with static typing.

PARAMETERS

COMMAND

Compilation command.
c / compile
Compile to C (default backend).
cpp
Compile to C++.
js
Compile to JavaScript.
objc
Compile to Objective-C.
check
Validate syntax and semantics without code generation.
doc
Generate HTML documentation from source.
-r, --run
Run the program after compilation.
-c, --compileOnly
Generate code without linking.
-d:release
Enable release optimizations.
-d:danger
Disable all runtime checks for maximum speed.
-o:FILE
Set the output filename.
--opt:speed|size|none
Optimization target.
--mm:arc|orc|refc
Select memory management strategy.
--threads:on
Enable multithreading support.
-f, --forceBuild
Force full rebuild of all modules.
--help
Display help information.

INSTALL

sudo pacman -S nim
sudo apk add nim
sudo zypper install nim
brew install nim
nix profile install nixpkgs#nim

CAVEATS

Requires C compiler for native builds. Garbage collected by default. Growing ecosystem.

HISTORY

Nim was created by Andreas Rumpf starting in 2005, originally named Nimrod.

SEE ALSO

nimble(1), gcc(1), python(1)