# Nim — Statically Typed Compiled Language That Feels Like Python > Nim is an efficient, expressive statically typed language that compiles to C, C++, or JavaScript, combining Python-like syntax with systems-level performance. ## Install Save as a script file and run: # Nim — Statically Typed Compiled Language That Feels Like Python ## Quick Use ```bash # Install Nim via choosenim curl https://nim-lang.org/choosenim/init.sh -sSf | sh # Hello world echo 'echo "Hello, Nim!"' > hello.nim nim c -r hello.nim ``` ## Introduction Nim is a statically typed compiled systems programming language that combines Python-like readability with the performance of C. It compiles to C, C++, Objective-C, or JavaScript, making it suitable for systems programming, web backends, scripting, and game development. ## What Nim Does - Compiles to C/C++/JS for native or browser-based execution - Provides powerful metaprogramming through templates and macros - Supports multiple memory management strategies including ARC and ORC - Offers a comprehensive standard library covering IO, networking, and parsing - Enables cross-compilation to virtually any platform with a C compiler ## Architecture Overview Nim's compiler parses source into an AST, runs macro expansions, performs semantic analysis with type inference, and emits C (or other target) source code. The generated C is then compiled by GCC, Clang, or MSVC. The ORC memory manager uses reference counting with a cycle collector, providing deterministic cleanup without stop-the-world pauses. ## Self-Hosting & Configuration - Install via `choosenim` or your OS package manager - Manage dependencies with `nimble`, Nim's built-in package manager - Configure compiler options in `nim.cfg` or `config.nims` files - Cross-compile by specifying `--cpu` and `--os` flags - Use `nim doc` to generate HTML documentation from source comments ## Key Features - Indentation-based syntax familiar to Python developers - Compile-time code execution and AST manipulation via macros - Deterministic memory management with ARC/ORC (no tracing GC needed) - Uniform function call syntax for clean method-chaining style - First-class async/await for non-blocking IO ## Comparison with Similar Tools - **Python** — Nim has similar syntax but is compiled and statically typed, offering much higher runtime speed - **Rust** — Rust has stricter safety guarantees; Nim is easier to learn with faster compile times - **Go** — Go uses a GC and has no generics templates; Nim offers more compile-time flexibility - **V** — V is newer with fewer libraries; Nim has a mature ecosystem and proven macro system - **Crystal** — Crystal compiles via LLVM with Ruby-like syntax; Nim compiles via C with Python-like syntax ## FAQ **Q: What memory management does Nim use?** A: Nim defaults to ORC, an automatic reference counting system with a cycle collector. You can also choose ARC (no cycle collector) or manual memory management. **Q: Can Nim compile to JavaScript?** A: Yes. Nim has a JavaScript backend, enabling code sharing between server and browser. **Q: How mature is the Nim ecosystem?** A: Nim has been in development since 2008 and has a stable 2.x release series with thousands of community packages on the Nimble directory. **Q: Is Nim suitable for embedded or real-time systems?** A: Yes. With ARC and manual memory management, Nim can run on resource-constrained platforms with deterministic behavior. ## Sources - https://github.com/nim-lang/Nim - https://nim-lang.org/documentation.html --- Source: https://tokrepo.com/en/workflows/asset-e44c4024 Author: Script Depot