Nim is an open source programming language created in 2008 by Andreas Rumpf.
git clone https://github.com/nim-lang/Nim
#48on PLDB | 16Years Old | 8kRepos |
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...
# Type your code here, or load an example.
proc square(num: int): int {.exportc.} =
num * num
echo "Hello, world!"
echo("Hello World")
# Hello world in Nim
echo "Hello World"
# 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
proc printf(formatstr: cstring) {.header: "<stdio.h>", varargs.}
printf("%s %d\n", "foo", 5)
Feature | Supported | Token | Example |
---|---|---|---|
Unicode Identifers | โ | let ฮด = 0.00001 |
|
Booleans | โ | true false on off | let res = true |
Strings | โ | " | "Hello world" |
Assignment | โ | = | |
MultiLine Comments | โ | #[ ]# | #[ A comment ]# |
Print() Debugging | โ | echo | |
Line Comments | โ | # | # A comment |
Static Typing | โ | ||
Case Insensitive Identifiers | โ | # Though they may be phased out: # https://github.com/nim-lang/RFCs/issues/456 |
|
Semantic Indentation | โ | ||
Macros | โ | # https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#macros import macros dumpTree: result = 10 |
|
Templates | โ | # https://hookrace.net/blog/introduction-to-metaprogramming-in-nim/#templates template debug*(args: varargs[string, `importOnly |
]) =