https://github.com/sgruszka/tree-sitter-bpftrace
bpftrace grammar for tree-sitter
https://github.com/sgruszka/tree-sitter-bpftrace
bpftrace grammar parser tree-sitter
Last synced: 4 months ago
JSON representation
bpftrace grammar for tree-sitter
- Host: GitHub
- URL: https://github.com/sgruszka/tree-sitter-bpftrace
- Owner: sgruszka
- License: mit
- Created: 2025-11-04T10:19:00.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2026-01-23T09:40:48.000Z (5 months ago)
- Last Synced: 2026-01-24T02:39:50.705Z (5 months ago)
- Topics: bpftrace, grammar, parser, tree-sitter
- Language: JavaScript
- Homepage:
- Size: 373 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README-rust.md
- License: LICENSE
Awesome Lists containing this project
README
# tree-sitter-bpftrace (Rust)
This crate provides Tree-sitter grammar bindings for the
[bpftrace](https://github.com/iovisor/bpftrace) language.
## Usage
Add to your Cargo.toml:
```toml
[dependencies]
tree-sitter = "0.26.3"
tree-sitter-bpftrace = "0.1.1"
```
## Example
```rust
fn main() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(&tree_sitter_bpftrace::LANGUAGE.into())
.expect("Error loading Bpftrace parser");
let source_code = r#"kprobe:tcp_reset { printf("PROBE") }"#;
let tree = parser.parse(source_code, None).unwrap();
let root_node = tree.root_node();
assert_eq!(root_node.kind(), "source_file");
println!("{}", root_node.to_sexp());
}
```