Parsing Protobuf Definitions with Tree-sitter

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Purpose built for real-time analytics at any scale.
InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • Protobuf

    Protocol Buffers - Google's data interchange format

    From the docs "The protocol compiler can output a FileDescriptorSet containing the .proto files it parses." (https://github.com/protocolbuffers/protobuf/blob/main/src/go...)

    I don't understand the point of using tree-sitter to repeat that work (almost certainly having bugs doing so). Am I missing something?

  • InfluxDB

    Purpose built for real-time analytics at any scale. InfluxDB Platform is powered by columnar analytics, optimized for cost-efficient storage, and built with open data standards.

    InfluxDB logo
  • protojson

    convert protobuf schemas into JSON

    I need to get around to playing with tree-sitter. The approach in this article is neat.

    Here's another approach. The AST of a .proto file is itself a protobuf. That's how the codegen plugins work. Protobuf also has a canonical mapping to JSON, so...

    What you can do is use protoc to parse the .proto file, spit it out as JSON, and then process that data using your favorite pattern matching language. I wrote a [tool][1] that helps with that. For example, here's some [js code][2] that translates protobuf message definitions into "types" for use in an ORM.

    [1]: https://github.com/dgoffredo/protojson

  • okra

    the okay relational automator

  • truss

    Truss helps you build go-kit microservices without having to worry about writing or maintaining boilerplate code.

    I found that some parts of a protobuf aren't captured well by protoc; specifically annotations were not well exposed to Go libraries for writing protoc plugins in 2016. I ended up having to write my own basic protobuf parser to reliably extract annotations and comments for code and documentation generation:

    https://github.com/metaverse/truss/blame/master/svcdef/svcde...

  • ragel

    Ragel State Machine Compiler

    I used to write proto parser using ragel <https://github.com/adrian-thurston/ragel> for work way back as well, it was surprisingly painless. Think this was way back when protobuf was transitioning to proto3.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Why should we use Protobuf in Web API as data transfer protocol.

    2 projects | dev.to | 28 Aug 2024
  • Another variable-length integer encoding

    2 projects | news.ycombinator.com | 11 Aug 2024
  • A protoc compiler plugin that generates useful extension code for Kotlin/JVM

    2 projects | dev.to | 28 May 2024
  • Show HN: Protobuf Editions now available in v27.0

    1 project | news.ycombinator.com | 24 May 2024
  • Hitting every branch on the way down

    4 projects | news.ycombinator.com | 29 Apr 2024

Did you konow that C++ is
the 6th most popular programming language
based on number of metions?