Skip to main content

Use the Clang + LLVM toolchain as an interpreter for C code.

Project description

cci

cci wraps tools in the LLVM toolchain to allow you to compile and run C programs on-the-fly using a JIT compiler, instead of requiring a dedicated compilation phase.

Requirements:

  • Python 3.6+
  • clang and lli executables.

Installation

pipx install cci

To test it, see the examples in the next section.

Usage

To use cci, you point the shebang line of a C file at it.

That is sufficient to use it, but you can also specify more arguments to e.g. enforce stricter error checking by Clang.

Due to limitations in how shebang lines work, when you use cci, you have to put arguments to Clang on the line immediately after the shebang line.

To avoid ambiguity, that line must start with "// cci:".

For example, save the following to "hello-world.c":

#!/usr/bin/env cci
// cci: -std=c11 -Wall -pedantic-errors
#include <stdio.h>
int main() {
    printf("Hello, world!\n")
    return 0;
}

Now, mark it as executable (on *nix, chmod +x hello-world.c), then run ./hello-world.c.

Debugging

If you include the argument "-###" in the arguments, it will be passed through to Clang for debugging purposes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cci-5.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

cci-5.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file cci-5.1.0.tar.gz.

File metadata

  • Download URL: cci-5.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.12.4

File hashes

Hashes for cci-5.1.0.tar.gz
Algorithm Hash digest
SHA256 fd619bf349fb771054db043aa1159f6fb30b9f52c4613942cdf963e4cf89fca7
MD5 b8621b90cea465d37fb93c344d2b2294
BLAKE2b-256 a8f0dafc7ca738e8396c401fc44fd1e61e6fc7bfc4ebb9375c03cc7535d0d0a1

See more details on using hashes here.

File details

Details for the file cci-5.1.0-py3-none-any.whl.

File metadata

  • Download URL: cci-5.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.12.4

File hashes

Hashes for cci-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60909da0b1fa274bff26758c36fc30710e2f2b8ec3881c3358e6ec0537ab5426
MD5 bc6af3dccf6365a727a5d4b4539c9973
BLAKE2b-256 901dff679127adde8dac792447f01cc2ddde72b2e9da2decb7e5af1ddd7574f6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page