Nim Programming Language Overview

In our ongoing series of alternative game development capable programming languages, today we are checking out Nim. Nim is a cross platform, open source statically compiled programming language inspired by Pascal and Python with a splash of Haxe-like metaprogramming added on top.

From the Nim homepage, Nim is described as:

Efficient

  • Nim generates native dependency-free executables, not dependent on a virtual machine, which are small and allow easy redistribution.
  • The Nim compiler and the generated executables support all major platforms like Windows, Linux, BSD and macOS.
  • Nim’s memory management is deterministic and customizable with destructors and move semantics, inspired by C++ and Rust. It is well-suited for embedded, hard-realtime systems.
  • Modern concepts like zero-overhead iterators and compile-time evaluation of user-defined functions, in combination with the preference of value-based datatypes allocated on the stack, lead to extremely performant code.
  • Support for various backends: it compiles to C, C++ or JavaScript so that Nim can be used for all backend and frontend needs.

Expressive

  • Nim is self-contained: the compiler and the standard library are implemented in Nim.
  • Nim has a powerful macro system which allows direct manipulation of the AST, offering nearly unlimited opportunities.

Elegant

  • Macros cannot change Nim’s syntax because there is no need for it — the syntax is flexible enough.
  • Modern type system with local type inference, tuples, generics and sum types.
  • Statements are grouped by indentation but can span multiple lines.

Thanks to the Nim package manager Nimble as well as binding generators such as c2nim, there are bindings to many of the most popular game development libraries including SFML, RayLib, SDL and Allegro, as well as frameworks such as OpenGL.

Additionally if you are a Godot Engine developer, there is an extension that enables you to script Godot games using the Nim language, called logically enough Godot-Nim. On the topic of Godot and Nim, there is also the Enu project and incredibly interesting real-time 3D environment where you can create worlds interactively using Nim as a scripting language.

In terms of tooling support, Nim has extensions available for both Visual Studio Code as well as JetBrains IDEs. Nim is an open source programming language with the source code hosted on GitHub. You can learn more about Nim in the video below.

Scroll to Top