Rust-first parsing for OpenMP and OpenACC directives with C, C++, and Fortran bindings, plus compatibility shims.
Experimental: APIs continue to evolve. Expect breaking changes between releases.
# Cargo.toml
[dependencies]
roup = "0.7"# C/C++/Fortran projects
cargo build --release
# Link against target/release/libroup.{a,so,dylib}Platform-specific notes live in the building guide.
- OpenMP 3.0–6.0 and OpenACC 3.4 coverage across directives, clauses, aliases, and combined forms.
- Debugger:
roup_debugprovides interactive and non-interactive step tracing for OpenMP/OpenACC (C and Fortran sentinels). - Rust, C, C++17, and Fortran APIs with a narrow unsafe boundary confined to the FFI bindings.
- Compatibility layers: drop-in replacements for ompparser and accparser (see
compat/). - Extensive tests: hundreds of automated checks plus OpenMP_VV/OpenACCV-V validation and compat ctests.
The mdBook at roup.ouankou.com provides tutorials, an architecture tour, and the API reference. Each chapter mirrors the sources under docs/book/src/.
use roup::parser::openmp;
use roup::lexer::Language;
fn main() {
let parser = openmp::parser().with_language(Language::C);
let (_, directive) = parser
.parse("#pragma omp parallel for num_threads(4)")
.expect("valid directive");
println!(
"parsed {:?} with {} clauses",
directive.name,
directive.clauses.len()
);
}More C/C++/Fortran samples live in examples/. The C/OpenACC headers are generated at build time as src/roup_constants.h.
cargo build --release
cargo testRebuild the docs with cargo doc --no-deps followed by mdbook build docs/book.
roup_debug is built alongside the library: cargo run --release --bin roup_debug '#pragma omp parallel' -- --non-interactive.
compat/ompparser/— drop-in replacement for the original ompparser.compat/accparser/— drop-in replacement for accparser with ROUP_ACC_* constants.
Each directory includes a build.sh that builds ROUP, the shim, and runs the bundled ctest suites.
See the contributing guide for coding standards, test expectations, and the pull-request workflow.
BSD-3-Clause License — see LICENSE.
© 2024–2025 Anjia Wang