Add protoscope language, assembler, disassembler#734
Open
sudorandom wants to merge 1 commit into
Open
Conversation
Adds `protoscope`, a human-readable text format for raw Protobuf binary wire payloads, to `protocompile`. It enables writing, parsing, compiling (assembly), and decompiling (disassembly) without requiring a schema. It supports multi-frame documents (separated by `---`) and transport framing (gRPC, ConnectRPC, and Varint delimited). - **Parser & AST (`internal/protoscope/parser`, `internal/protoscope/ast`)**: Parses tokens into an AST of fields, blocks (groups/length-delimited), values, and options. - **Assembler (`internal/protoscope/assembler`)**: Compiles AST nodes into raw Protobuf wire format. - **Disassembler (`internal/protoscope/disassembler`)**: Decompiles binary Protobuf payloads back to protoscope text format using heuristics. - **Public API (`protoscope`)**: Exposes public endpoints (`Assemble`, `Disassemble`, `Diagnostics`, `Hover`, and `Possibilities`) for integrations (e.g. Buf LSP). Handles frame splitting/joining, flags parsing, and context-aware hover info. - `Fuzz tests` and a few related fixes as a result of the fuzz testing. Changes in `experimental/internal/lexer/number.go` is an example of changes made to avoid a DoS vector that was revealed with this testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
protoscope, a human-readable text format for raw Protobuf binary wire payloads, toprotocompile. It enables writing, parsing, compiling (assembly), and decompiling (disassembly) without requiring a schema. It supports multi-frame documents (separated by---) and transport framing (gRPC, ConnectRPC, and Varint delimited).Key Changes
internal/protoscope/parser,internal/protoscope/ast): Parses tokens into an AST of fields, blocks (groups/length-delimited), values, and options.internal/protoscope/assembler): Compiles AST nodes into raw Protobuf wire format.internal/protoscope/disassembler): Decompiles binary Protobuf payloads back to protoscope text format using heuristics.protoscope): Exposes public endpoints (Assemble,Disassemble,Diagnostics,Hover, andPossibilities) for integrations (e.g. Buf LSP). Handles frame splitting/joining, flags parsing, and context-aware hover info.Fuzz testsand a few related fixes as a result of the fuzz testing. Changes inexperimental/internal/lexer/number.gois an example of changes made to avoid a DoS vector that was revealed with this testing.