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
1,165 downloads per month
Used in 2 crates
(via bpflint)
4MB
123K
SLoC
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());
tree-sitter-bpf-c
BPF C grammar for tree-sitter.