The C Compiler for Code Snippets

C programming in a different way: with type inference.

What can Cnippet do for me?

Support development, debugging, testing, and static-analysis of C programs.

Focus on the algorithm

With Cnippet you don't need to declare types (e.g. astruct), they are automatically created based on how program variables are used. Cnippet features a type-inference engine similar to the one from Haskell and ML. Any struct, typedef, or function prototype "missing" from the source is written in a separate header. Because C has a nominal type-system you just need to ensure that type names are consistent.

Debug, test, and analyze snippets

Do you want to debug, static-analyze, or generate input-data for a standalone patch, without having to clone and compile the entire project? By using Cnippet, you can avoid doing so in many cases. Let Cnippet infer the types and only provide the values necessary for the task in question. In the end, you'll have a compilable program suitable to be used with a variety of tools.

Reconstruct headers

Are you porting a code base across different systems? Or reviving an application that depends on legacy and unavailable components? Or Implementing support for your platform in Valgrind? Cnippet can help you achieve those goals: the header we produce is a precise match for the API discovered in the source. If necessary, you can fine-tune it afterwards.

Cnippet is in evaluation phase. Request a license for free!

Licenses are individual, for a single user.


6-month license

  • Commercial use
  • Ticket priority
Buy 1 license


US$ --
1-year license

  • Commercial use
  • Ticket priority
Buy 1 license


US$ --
1-year license

  • Commercial use
  • Ticket priority
Buy 10 licenses

How does Cnippet work?

Feature One

Cnippet is a C compiler for code snippets. Its type-inference engine is powered by PsycheC.

As opposed to a conventional C compiler, Cnippet doesn't expect that names appearing in the program are accompanied by a declaration. When an unresolved type is encountered, Cnippet automatically defines it.

What makes Cnippet cool:

  • Seamless interface with the host C compiler (GCC and Clang supported).
  • Easy integration into makefiles or similar build systems.
  • Ability to discover and match standard library names.
  • Understanding of commom platform-specific macros.
  • Algorithmic resolution of syntax ambiguities (heursitics available too).
  • A "no type declaration" mode, where structs are forbidden.