6 releases

0.2.3 Nov 19, 2025
0.2.2 Jul 29, 2025
0.1.0 Jul 1, 2025
0.0.0 Jun 30, 2025

#534 in Text editors

Download history 6/week @ 2025-09-12 179/week @ 2025-09-19 155/week @ 2025-09-26 95/week @ 2025-10-03 35/week @ 2025-10-10 188/week @ 2025-10-17 88/week @ 2025-10-24 54/week @ 2025-10-31 72/week @ 2025-11-07 363/week @ 2025-11-14 454/week @ 2025-11-21 309/week @ 2025-11-28 38/week @ 2025-12-05

1,165 downloads per month
Used in 2 crates (via bpflint)

MIT license

4MB
123K SLoC

C 123K SLoC Scheme 76 SLoC // 0.0% comments JavaScript 45 SLoC // 0.1% comments Rust 37 SLoC // 0.1% comments

This crate provides BPF C language support for the tree-sitter parsing library.

Typically, you will use the LANGUAGE constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
  SEC("kprobe/cap_capable")
  int BPF_KPROBE(kprobe__cap_capable, const struct cred *cred,
                 struct user_namespace *targ_ns, int cap, int cap_opt) {
  	return record_cap(ctx, cred, targ_ns, cap, cap_opt);
  }
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_bpf_c::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading BPF-C parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

pipeline crates.io

tree-sitter-bpf-c

BPF C grammar for tree-sitter.

Dependencies