Get the latest tech news

Parsing Protobuf Definitions with Tree-sitter


If you work with Protocol Buffers (protobuf), you can really save time, boredom, and headache by parsing your defin…

If you work with Protocol Buffers ( protobuf), you can really save time, boredom, and headache by parsing your definitions to build tools and generate code. In the process I realized how awesome the Tree-sitter parsing library is and that it probably was going to support extracting everything I wanted to get from our protobuf definitions. The library supports various methods of access to the parsed tree, but the one we’ll use here is a query expression that will extract only the data we care about.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of sitter

sitter

Photo of Protobuf Definitions

Protobuf Definitions