Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

Nim

Nim is a compiled, garbage-collected systems programming language with a design that focuses on efficiency, expressiveness, and elegance (in that order of priority).

Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402Star full 4f7b624809470f25b6493d5a7b30d9b9cb905931146e785d67c86ef0c205a402 (1 ratings)
Rated 5.0 out of 5
Subscribe to updates I use Nim


Statistics on Nim

Number of watchers on Github 4672
Number of open issues 1266
Average time to close an issue 1 day
Main language Nimrod
Average time to merge a PR 1 day
Open pull requests 227+
Closed pull requests 135+
Last commit about 2 years ago
Repo Created over 9 years ago
Repo Last Updated about 2 years ago
Size 65 MB
Homepage http://nim-lang.org/
Organization / Authornim-lang
Contributors185
Page Updated
Do you use Nim? Leave a review!
View open issues (1266)
View Nim activity
View on github
Fresh, new opensource launches πŸš€πŸš€πŸš€
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating Nim for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)
What people are saying about Nim Leave a review
Easy to read and write, great performance and modern!

Nim Build Status

This repository contains the Nim compiler, Nim's stdlib, tools and documentation. For more information about Nim, including downloads and documentation for the latest release, check out Nim's website.

Community

Join the IRC chat Join the Gitter chat Get help View Nim posts on Stack Overflow Follow @nim_lang on Twitter

  • The forum - the best place to ask questions and to discuss Nim.
  • #nim IRC Channel (Freenode) - a place to discuss Nim in real-time. Also where most development decisions get made.
  • Gitter - an additional place to discuss Nim in real-time. There is a bridge between Gitter and the IRC channel.
  • Stack Overflow - a popular Q/A site for programming related topics that includes posts about Nim.
  • Github Wiki - Misc user-contributed content.

Compiling

The compiler currently officially supports the following platform and architecture combinations:

  • Windows (Windows XP or greater) - x86 and x86_64
  • Linux (most, if not all, distributions) - x86, x86_64, ppc64 and armv6l
  • Mac OS X (10.04 or greater) - x86, x86_64 and ppc64

More platforms are supported, however they are not tested regularly and they may not be as stable as the above-listed platforms.

Compiling the Nim compiler is quite straightforward if you follow these steps:

First, the C source of an older version of the Nim compiler is needed to bootstrap the latest version because the Nim compiler itself is written in the Nim programming language. Those C sources are available within the nim-lang/csources repository.

Next, to build from source you will need:

  • A C compiler such as gcc 3.x/later or an alternative such as clang, Visual C++ or Intel C++. It is recommended to use gcc 3.x or later.
  • Either git or wget to download the needed source repositories.
  • The build-essential package when using gcc on Ubuntu (and likely other distros as well).

Then, if you are on a *nix system or Windows, the following steps should compile Nim from source using gcc, git and the koch build tool (in the place of sh build.sh you should substitute build.bat on x86 Windows or build64.bat on x86_64 Windows):

git clone https://github.com/nim-lang/Nim.git
cd Nim
git clone --depth 1 https://github.com/nim-lang/csources.git
cd csources
sh build.sh
cd ../
bin/nim c koch
./koch boot -d:release

Finally, once you have finished the build steps (on Windows, Mac or Linux) you should add the bin directory to your PATH.

Koch

koch is the build tool used to build various parts of Nim and to generate documentation and the website, among other things. The koch tool can also be used to run the Nim test suite.

Assuming that you added Nim's bin directory to your PATH, you may execute the tests using ./koch tests. The tests take a while to run, but you can run a subset of tests by specifying a category (for example ./koch tests cat async).

For more information on the koch build tool please see the documentation within the doc/koch.rst file.

Nimble

nimble is Nim's package manager and it can be acquired from the nim-lang/nimble repository. Assuming that you added Nim's bin directory to your PATH, you may install Nimble from source by running koch nimble within the root of the cloned repository.

Contributors

This project exists thanks to all the people who contribute. Read on to find out how to contribute.

Contributing

Backers on Open Collective Sponsors on Open Collective Setup a bounty via Bountysource Donate Bitcoins Open Source Helpers

We welcome all contributions to Nim regardless of how small or large they are. Everything from spelling fixes to new modules to be included in the standard library are welcomed and appreciated. Before you start contributing, you should familiarize yourself with the following repository structure:

  • bin/, build/ - these directories are empty, but are used when Nim is built.
  • compiler/ - the compiler source code. Also includes nimfix, and plugins within compiler/nimfix and compiler/plugins respectively.
  • nimsuggest - the nimsuggest tool that previously lived in the nim-lang/nimsuggest repository.
  • config/ - the configuration for the compiler and documentation generator.
  • doc/ - the documentation files in reStructuredText format.
  • lib/ - the standard library, including:
    • pure/ - modules in the standard library written in pure Nim.
    • impure/ - modules in the standard library written in pure Nim with dependencies written in other languages.
    • wrappers/ - modules which wrap dependencies written in other languages.
  • tests/ - contains categorized tests for the compiler and standard library.
  • tools/ - the tools including niminst and nimweb (mostly invoked via koch).
  • web/ - the Nim website.
  • koch.nim - tool used to bootstrap Nim, generate C sources, build the website, and generate the documentation.

If you are not familiar with making a pull request using GitHub and/or git, please read this guide.

Ideally you should make sure that all tests pass before submitting a pull request. However, if you are short on time, you can just run the tests specific to your changes by only running the corresponding categories of tests. Travis CI verifies that all tests pass before allowing the pull request to be accepted, so only running specific tests should be harmless. Integration tests should go in tests/untestable.

If you're looking for ways to contribute, please look at our issue tracker. There are always plenty of issues labelled Easy; these should be a good starting point for an initial contribution to Nim.

You can also help with the development of Nim by making donations. Donations can be made using:

If you have any questions feel free to submit a question on the Nim forum, or via IRC on the #nim channel.

Backers

Thank you to all our backers! [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

You can also see a list of all our sponsors/backers from various payment services on the sponsors page of our website.

License

The compiler and the standard library are licensed under the MIT license, except for some modules which explicitly state otherwise. As a result you may use any compatible license (essentially any license) for your own programs developed with Nim. You are explicitly permitted to develop commercial applications using Nim.

Please read the copying.txt file for more details.

Copyright 2006-2017 Andreas Rumpf, all rights reserved.

Nim open issues Ask a question     (View All Issues)
  • over 3 years Overloading with static[] leads to strange error
  • over 3 years Internal error when using array of procs
  • over 3 years mitems on seq of tuples not working in VM
  • over 3 years var s = @[0,1,2,...] can generate thousand of single assignments in C code
  • over 3 years Improvements to times.nim
  • over 3 years Unsupported OpenSSL library imported dynamically
  • over 3 years read of failed future messages pile up in exception when using try/except with async/await
  • over 3 years httpclient.nim 's gc-unsafe async proc
  • over 3 years nre module breaks os templates
  • over 3 years newAsyncSocket should raise an OS error plus other inconsistencies
  • over 3 years asyncdispatch recv() procs do not respect absence of SafeDisconn flag
  • over 3 years Missing file name and line number in error message
  • over 3 years Using generic static[int] as parameter in another static[...] parameter
  • over 3 years Compilation of symlinked files appear in wrong directory.
  • over 3 years finish.exe crashes immediately
  • over 3 years Compilation breaks without showing an error
  • over 3 years Type inferring templates do not work with non-ref types.
  • over 3 years Improve `joinThreads` for windows
  • over 3 years Weird variable/proc name redefinition bug
  • over 3 years system.toInt(float) raises no exception in Nim v 0.15.2 Linux
  • over 3 years defer crashes in closure for os.walkDir()
  • over 3 years [Req] Better deprecation warning
  • over 3 years [windows 7]bug: incorrect os.FileInfo.size
  • over 3 years Error: cannot 'importc' variable at compile time
  • over 3 years Assignment is broken for tuple with NimNode inside
  • over 3 years Nim and gcc do not agree on target architecture (32/64bit)
  • over 3 years Channels: crashes in `tryRecv` and `send`
  • over 3 years async: annoying warning for future.finished
  • over 3 years Can't use genSym node for formal parameter type
  • over 3 years Clean up root of repo and release archives
Nim open pull requests (View All Pulls)
  • Added -Wpragmas ignore
  • depreciate timeToTimeInfo, add str->time procs
  • IPv6 support for httpclient
  • Use tables instead of seqs for json objects
  • add udp support to asyncnet
  • Fix "db_odbc" query results when empty, run the wrong problem.
  • db_odbc - row reading bug fix
  • sequtils - doco fix & tests moved to test suite
  • fixed #3731, #3729
  • gettype2 prototype implementation
  • RFC: enhance parsecsv
  • Allow more switches to be set in nims
  • Add SO_REUSEPORT support
  • Logger must respects global filter level
  • add &= for seqs to system.nim
  • fixes #3496
  • Borrow all: type some {.borrow.} = distinct other
  • net.nim: add support for Unix sockets
  • Allow binding to ports >= 32768, fixes #3484
  • Add support for TLS-PSK ciphersuites to net.nim
  • Add maxsplit argument to strutils.split
  • In C code generation shallowCopy() was (not correctly) deep copy
  • Add access to thread handle under Windows
  • Adding Unix Socket
  • Added basic stdout and stderr support for nodejs
  • [Don't merge] [RFC] not nil - default for pointer types, or nil - optional
  • Rewrote procs for float32/float64
  • Mark some constructors as not nil.
  • Fixes foldl() and foldr() + foldl() with start parameter
  • Use _beginthreadex to create threads on windows instead of CreateThread
  • Allow likely(x) and unlikely(x) in all targets, fix #3882
  • db_odbc ,Fix the field values to be null when the release schema is compiled.
  • fix type used for chckRange node boundaries
  • Fixed macros unpackX procedured to return values correctly
  • Add nimscript test and run it in Travis CI
  • YAML highlighting support for doctools/highlite
  • fix initAllocator not being called when defined(nogc) and not defined…
  • New overloaded generic constructor for JSON data
  • Gen extern "C" for .importc proc decls when compiling to C++
  • store block size in when using malloc and nogc
  • Fix #4040
  • pure/logging: add notice level, suggest usecases
  • Update parsecfg.nim
  • getTypeInst
  • Blacklist far and near to get mangled names.
  • Add ``readFile`` implementation for nimvm
  • Json serialization for openarrays and objects
  • Fixes #4066
  • Adds error on detection of recursive tuple type
  • Generate NRE docs for website
  • Add another JSON example
  • Introduce toHex() proc without length parameter.
  • Implementation of formatEng/formatSize and their dependencies
  • strutils: isEmpty proc
  • Implement protection on callback environment.
  • Add noSideEffect pragmas to procs and iterators in tables.nim
  • New async core
  • Add currentSourceDir template to the system module
  • Added closureScope template
  • Update asyncfile.nim
  • Use relative paths in install script template
  • Another try to fix issue #4375
  • Added addPragma routine
  • Add unicode procs
  • Fix issue #4375
  • Improvements to tables.clear()
  • Fix #4305: Make split proc for set[char] consistent
  • Fix #4275: Argument count not checked in importcpp
  • Prevent memory re-initialisation for complex values with GC'ed refs
  • Added iterator for utf8 strings
  • Fixed #4065
  • Remove useless assertion in net.nim
  • Fix crash when string is nil in failing unittest
  • Add db_mysql get rows data func result is table, Not seq.
  • Add comments to clarify the roles of abstractX and typedescX types.
  • Optimise pickBestCandidate: reduce heap allocations.
  • Calculate correct yearday in times.parse
  • Implement codegen for mArrGet/mArrPut to handle distinct types.
  • fixed #4459 -- VS2010 error C2275
  • Add sorting by key to Tables json.pretty()
  • Add a workaround for threadpool deadlocks on recursion
  • Compiler cleanup
  • upcoming_async: Borrow for AsyncEvent.
  • Implement population count operation in standard library
  • PNode sons: tidy and optimise
  • Asyncftpclient:retrfile support rfc959&3659
  • Added generic Complex type, floating-point comparison, and `**` exponentiation operator for floats and complex.
  • ODBC db Error 24000, But the cmd was executed successfully
  • Fixes #1994
  • Fixes #4871
  • Fix accessor lifting for objects with case section
  • Add respond proc example
  • Add VCC wrappers
  • Added icons support for Visual Studio compiler
  • Some useful macros
  • Enable JIT in PCRE to improve regular expressions performance
  • Added js console object
  • [Tester] allow running single tests with 'run' option
  • tests: add more tests for getFileInfo()
  • [Compiler Messages] Change kind of message position after title
  • Linux thread types
  • Modify the type signature of shl and shr to allow the shift amount to…
  • Check return value of newNativeSocket before use
  • Replaced mktime() by timegm()
  • Omit system.nim and gc.nim in frameinfo of a cell
  • Fixed timezone sign error
  • {.this: self.} pragma now accepts the self argument in all positions
  • reject seq[object], fixes #3069
  • Replace the algorithm of proc toRational
  • list/queue addition of map, apply et. al.
  • Make xmltree.innerText recursive, define for all node kinds
  • async: some fixes more.
  • [dont merge] Fixed dynlink with OpenSSL >1.1.0. Added loadLibPattern.
  • Fixes #5065
  • extend findExe to find cmd and bat
  • Add `random` Nimble package to stdlib.
  • Add warning about cryptographic use of random.nim
  • Add JSON tests based on https://github.com/nst/JSONTestSuite
  • fix abi type sizes based on checkabi/linux/amd64
  • Added FileSeekPos
  • Fixes #5112 (Fix error messages raised when multiple modules have the same original name)
  • Addition of map, apply et. al. to lists and deques
  • Fix #5128, #5184.
  • Implement RFC #4873 improvements to JavaScript FFI
  • Create temp var in deepcopy if needed
  • add bitopts module for optimized bit manipulation.
  • Add waitFor on seq[Future], waitAll and more
  • re additions for buffer (cstring) RE matching
  • Add len for Slice[T] where T is ordinal (#5703)
  • Added codeRepr and dumpCode to the macros module.
  • Introduce first class support for Android
  • Fix #5070
  • [WIP] Better Future
  • Modified ospath's getConfigDir to meet XDG spec
  • Updating documentation for passC and passL pragmas
  • Fix type inference with static literals.
  • Async macro fixes
  • osproc: fix double close on POSIX
  • Improve parseCookies doc
  • compiler option for testament
  • a few tiny cleanups
  • Libc poc
  • Deprecate macros.getType and improve documentation in related procs.
  • FIx a number of regressions introduced with the concepts branch
  • Doc *.idx path fix #1976
  • implement sizeof and alignof operator
  • fixes #5570, fixes #5602 generic parameter substitution
  • Catch illegal recursion in generic types in some cases (also fix #5629)
  • Update for vccexe tool
  • added parseQuery() and newQuery() to uri.nim
  • added rotate in algorithm
  • Fix dispatcher leaking FDs when thread exits
  • add 'swapEndian' intrinsics to bitops & swapEndianInt to endians module .
  • Fixing #5884
  • Fix #5856
  • Add clarification on how to create custom exceptions.
  • Add mips64 and mips64el CPU platforms
  • Remove expr/stmt
  • Fix a compiler crash on array type check (#5780)
  • Creating and setting comment nodes in macros
  • review and merge zahary's work
  • Add len for Slice[T] where T is ordinal
  • fixes #5795
  • proc `*` for typedesc
  • cgen: #undef some more predefined symbols.
  • makefile.tmpl: fix error handling and cleanups
  • remove ArrayDummySize with unchecked arrays
  • fixes countup/countdown for custom types.
  • Allow only single infix as in except branches. Fixes #7115
  • Use truncation division in mod for floats
  • Fix compiler crash on try expression with infix as (issue #7116)
  • Move typetraits.`$` to system. Fixes #5827.
  • Date time proposed improvements
  • [WIP] Raise/catch cpp imported exceptions
  • Add default argument to tables.getOrDefault
  • POC make fmt"{foo}\n{\bar}" do the right thing
  • `sets` assign operators
  • Add overloads for readAll and readFile that use an out param
  • CI: Don't to run the tests if only the docs were updated (WIP)
  • Sub second time resolution
  • Fix bug for getch on Windows while using the arrow keys
  • Install uncaught exception handler in cpp (#6512)
  • Added `macros.inheritsFrom`.
  • Add a flatItems iterator and flatten proc to sequtils
  • Async improvements
  • Include testament testesults in CI logs
  • Add splitPathComponents and tests
  • C++ backend example
  • Implement SSL/TLS certificate checking #782
  • Decouple futures completion from dispatchers
  • WIP: Experimental using metrohash in the compiler
  • Allow parsing URIs without authority
  • Fix #6541
  • Add normalizePath, absolutePath and tests
  • nimsuggest: Epc highlight format change
  • checkModuleName uses non-canonicalized path name
  • Memfiles error on closing with windows
  • Add string-to-hex and back conversions
  • Add `parseHtml` overload for string
  • genTryCpp to catch by Nim type, further ideas required
  • fixed PHP variable generation
  • Fixes #6853
  • add more functionality from sets to intsets
  • Improve semchecking for duplicate cases in case statements
  • Make range checks in semConv
  • strip() only works at the beginning or ending of a string. Fixes #7159.
  • Fixes #4995.
  • Fixes #7126.
  • Add getPassword proc to terminal module
  • Allow float argument to sleepAsync() to allow sub-millisecond resolution
  • Fixes #2897
  • Fixes #2897.
  • Fixes #5880.
  • Fix return for js async
  • Fix #7212
  • User pragmas hide effect specs bug fix. Fixes #7216
  • add example to docs for getTypeInst and getTypeImpl
  • Add procs for serializing tables to JSON
  • Fix background-color in nimdoc.cfg
  • Fix #7304 by clarifying integer width in manual
  • Add CommentStmt to astGenRepr
  • Replace factorial function with a compile time one
  • [WIP] Regression test
  • add unsetControlCHook to remove a Ctrl-C hook after it was set
  • fix for Regression that the introduction of BackwardsIndex introduced
  • [Windows] Fix command line arguments limit using gcc
  • fix for #7252
Nim questions on Stackoverflow (View All Questions)
  • Nim `Warning: re is deprecated`, what to use instead?
  • Nim: Include C header for Posix
  • Run Nim code at compile time
  • I am doing the program the subtracting game (NIM) in one of my exercises its asking me for another loop around the main loop
  • How do I recover from a failed import in Nim?
  • How to create a nim dll and call it from c#
  • Is it possible / easy to include some mruby in a nim application?
  • nim nimscript is not executing commands
  • Particular Nim game variant (2 or 3 sticks)
  • Nim game not working Java
  • nim re, regex modul is not filling match group
  • Nim FFI: Using existing type to wrap a C++ type
  • Nim compiler fails with "Requested command not found: gcc.exe"
  • interop with nim return Struct Array containing a string /char* member
  • Game of Nim, computer will not make move
  • I'm trying to create a Nim straw game
  • Circular NIM Game
  • Using Nim to connect to a SQLite database
  • writing/reading binary file in Nim
  • reading files from tar.gz archive in Nim
  • How to correctly create a nim/nimrod windows dll
  • Nim application refuses to run on heroku
  • NIM game and AI player using Minimax algorithm - AI makes losing moves
  • 3-pile Nim Game in Scheme
  • Statically linking Nim code to Go
  • Nim inter-thread message passing: How to avoid a global TChannel?
  • Nim: How to prove not nil?
  • Nim code parser
  • What's the meaning of "magic" pragma in nim?
  • Nim Game is not working !(JAVA)
Nim list of languages used
Other projects in Nimrod