Linux command
nim 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
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]
说明
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.
参数
- 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.
FAQ
What is the nim command used for?
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.
How do I run a basic nim example?
Run `nim c [program.nim]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does c / compile do in nim?
Compile to C (default backend).