No description
Find a file
2025-08-28 10:16:26 +02:00
.github test c2nim with 2.0.0 (#272) 2023-11-07 19:17:55 +08:00
compiler Allow multiple mangles (#264) 2023-03-23 16:34:25 +01:00
doc Add clib pragma for configurable dynlib vs header (#270) 2023-04-14 12:37:30 +02:00
testsuite add i2c_master (#280) 2025-08-28 10:16:26 +02:00
.gitattributes Add .gitattributes (#145) 2018-11-02 07:57:08 +01:00
.gitignore Reorder comments, function attributes, and macro def args (#251) 2022-12-09 21:45:06 +01:00
.travis.yml Backward compatibility (#172) 2019-07-16 17:35:37 +02:00
c2nim.nim Better handling of CPP static methods (#263) 2023-02-22 21:03:36 +01:00
c2nim.nimble Better handling of CPP static methods (#263) 2023-02-22 21:03:36 +01:00
c2nim.nims make c2nim compatible with 1.2.0 (#248) 2022-08-10 12:16:22 +02:00
clexer.nim Reorder comments, function attributes, and macro def args (#251) 2022-12-09 21:45:06 +01:00
cparser.nim add i2c_master (#280) 2025-08-28 10:16:26 +02:00
LICENSE.txt imported c2nim from the compiler's sources 2014-06-28 16:03:32 +02:00
mangler.nim Add clib pragma for configurable dynlib vs header (#270) 2023-04-14 12:37:30 +02:00
postprocessor.nim Allow multiple mangles (#264) 2023-03-23 16:34:25 +01:00
preprocessor.nim Add clib pragma for configurable dynlib vs header (#270) 2023-04-14 12:37:30 +02:00
README.md documentation updates 2021-05-25 23:05:03 +02:00

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.