c3

Crates.ioc3
lib.rsc3
version0.11.2
sourcesrc
created_at2017-08-18 01:40:15.836784
updated_at2023-10-22 00:05:28.84587
descriptionComplete C AST. Enables analysis and generation of code derived from C. Built using LLVM 4/Clang using some fragile C++ APIs to work around missing data and ambiguities in libclang.
homepagehttps://gitlab.com/citrus-rs/c3
repositoryhttps://gitlab.com/citrus-rs/c3.git
max_upload_size
id27945
size140,720
Kornel (kornelski)

documentation

https://docs.rs/c3

README

C3: A tree of C nodes

This crate parses C files and exposes them as an abstract syntax tree.

The AST is a relaxed version of C's usual structure (e.g. everything pretends to be an expression), but contains enough information to rebuild complete source code. The AST also allows for some Rust features not found in C files. This is enables Citrus to convert C to Rust.

It uses LLVM and Clang's unstable C++ API. Currently, it supports LLVM 4 or 5, and requires static linking with libclang.

The stable Clang API does not expose a real AST, but a flattened, incomplete and ambiguous view of it. This crate works around the bad parts to extract more complete view of C files from Clang.

On the Rust side it's based on bindgen.

Building

Follow these instructions.

Commit count: 79

cargo fmt