#protobuf #ast-parser #protobuf-parser #ast

protobuf-ast-parser

A Protocol Buffers (proto2/proto3) parser that produces a typed AST with comments

1 unstable release

Uses new Rust 2024

0.1.0 Dec 28, 2025

#2354 in Parser implementations

MIT license

52KB
1.5K SLoC

Rust 1K SLoC LALRPOP 233 SLoC // 0.2% comments

Protocol Buffers (proto2/proto3) parser that produces a typed AST.

Examples

use protobuf_ast_parser::parse;

let source = r#"syntax = "proto3"; message User { string name = 1; }"#;
let ast = parse(source).expect("valid proto");
assert!(!ast.is_empty());

protobuf-parser

A Rust parser for Protocol Buffers (proto2 and proto3) built with LALRPOP + Logos. It focuses on turning .proto files into a lightweight AST while preserving comments, which is handy for tooling, linting, and analysis workflows.

Usage

use protobuf_parser::parse;

let source = r#"
syntax = "proto3";
message User { string name = 1; }
"#;

let ast = parse(source)?;

Dependencies

~3–5.5MB
~104K SLoC