c2nim

c2nim is a tool to translate Ansi C code to Nim.

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:23

Installation

nimble install c2nim
choosenim install c2nim
git clone https://github.com/nim-lang/c2nim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
c2nim - - - - - - -

Source

Repository https://github.com/nim-lang/c2nim
Homepage https://github.com/nim-lang/c2nim
Registry Source nimble_official

README

c2nim

c2nim is a tool to translate ANSI C code to Nim. The output is human-readable Nim code that is meant to be tweaked by hand after the translation process. c2nim is no real compiler!

Please see the manual here.

Installing

Run nimble install c2nim.

Translating

c2nim is preliminary meant to translate C header files. Because of this, the preprocessor is part of the parser. For example:

  #define abc 123
  #define xyz 789

Is translated into:

  const
    abc* = 123
    xyz* = 789

c2nim is meant to translate fragments of C/C++ code and thus does not follow include files. c2nim cannot parse all of ANSI C/C++ and many constructs cannot be represented in Nim.