DEV Community

Jør∂¡
Jør∂¡

Posted on

Nim: from scripting to C code. The all-in-one language

Today I’d like to talk a bit about NIM, a programming language that I have recently discovered.

You may be used to two different types of languages:

  • Native compiled languages (C, C++, Go, Rust, …)

  • Scripting or interpreted languages (Javascript, Python, Bash, …)

Each of those have their pro’s and con’s, but today we are here to discover the best of both worlds with Nim.

What makes it different?

C language as a target

Unlike the typical systems programming languages, Nim allows to compile dependency-free static binaries by precompiling your project to plain old C code.

However, Nim also allows you to compile your projects to C++ or Javascript. This enables to program both backend and frontend projects using the same knowledge.

Templates and macros are defined using Nim itself

If you are familiar with the typical #define, #ifdef, etc constructs in C, you’ll feel at home with Nim, because the language is flexible enough to support them by itself.

Nimscript

When you are targeting internal scripts and automation tasks, you can rely on Nim to do the work for you. Nimscript is a subset of the language that allows to run running custom operations on a more comfortable language. Unlike the traditional shell interpreters, Nim is fully cross-platform and you can opt for a binary or script approach without changing any mental context.

Personally, I’m excited to play a bit with it and see what it can do 🍭
To me, it looks concise, clean and well thought out. I’ve seen it being used for game development, crypto apps, scripts and more.

I’m currently working on a first use-case tool that makes use of it on a really cool topic. If all goes smoothly I’ll write a full post about both the language and the “thing” that it will provide.

Stay tuned for more.
Until then, take care!

Photo by [Conor Luddy](https://unsplash.com/@opticonor?utm_source=medium&utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&utm_medium=referral)Photo by Conor Luddy on Unsplash

Top comments (0)