PLDB
Languages Features Calendar About Lists Add Language
GitHub icon

Nim

Nim

Nim is a programming language created in 2008 by Andreas Rumpf.

Nim (formerly named Nimrod) is an imperative, multi-paradigm, compiled programming language designed and developed by Andreas Rumpf. It is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C and compiling to JavaScript, C and C++.. Read more on Wikipedia...

Try now: Riju ยท TIO

#60on PLDB 14Years Old 19.1kUsers

Example code from Riju:

echo "Hello, world!"

Example code from hello-world:

echo("Hello World")

Example code from the Hello World Collection:

# Hello world in Nim echo "Hello World"

Example code from Linguist:

# from: https://github.com/nim-lang/Nim/blob/27b081d1f77604ee47c886e69dbc52f53ea3741f/compiler/nimfix/nimfix.nim.cfg # Special configuration file for the Nim project # gc:markAndSweep hint[XDeclaredButNotUsed]:off path:"$projectPath/.." path:"$lib/packages/docutils" path:"$nim" define:useStdoutAsStdmsg symbol:nimfix define:nimfix cs:partial #define:useNodeIds define:booting define:noDocgen

Example code from Wikipedia:

proc printf(formatstr: cstring) {.header: "<stdio.h>", varargs.} printf("%s %d\n", "foo", 5)

Language features

Feature Supported Example Token
Strings โœ“
"Hello world"
"
Assignment โœ“ =
MultiLine Comments โœ“
#[ A comment
]#
#[ ]#
Print() Debugging โœ“ echo
Line Comments โœ“
# A comment
#
Static Typing โœ“
Semantic Indentation โœ“
Macros โœ“
https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#macros
Comments โœ“

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements ยท Email ยท GitHub