Skip to content

DanielSharp01/eprotoc

Repository files navigation

eprotoc

eprotoc is a compiler written for a modernized version of the protobuf descriptor language. eprotoc is designed to be used with typescript for code generation purposes.

Differences from protobuf

  • Packages like module system instead of importing files

  • Generics support

  • Date as a builtin type

  • Instead of repeated the generic type Array<T> is used

  • There are string enums next to numeric ones

  • No reserved fields

  • No OneOf it's equivalent to a message with optional arguments where only one can be given

  • No nested messages

  • No keyword option on definitions

  • Enums don't support string values for that there is string enum

"Evolved" eproto

The "e" in eproto is meant to be evolved. As such eproto is not meant to be an extension of protobuf. In fact it isn't even wire compatible by default.

Here are a list of incompatibilities with proto:

  • Nullable is represented as a 1 or 1 + byteLength LEN tagged field
  • There are top level types (tags with field number = 0)
  • Currently even top level messages require a LEN tag (with field number = 0) maybe will be fixed
  • Arrays can be optional which in normal proto is not
  • Arrays can be nested which in normal proto is not
  • Arrays cannot be sent in separate bits they are always packed into a single LEN

These incompatibilities mostly stem from the fact that I allow eproto to make use of field numberless LEN wire typed tags. In normal proto 2 as a tag is invalid as it does not have a field number

"Native" eproto

Native in this context means compatible with protobuf. Encodings generated by the codegen would have an equivalent version that could be generated by protoc.

In the native case the protobuf can get generated as well.

Native still wouldn't be one to one compatbile from the parsing perspective. I just don't find value in non packed arrays.

Development

  • Top level messages should not require LEN
  • "Native" codegen
  • Codegen (eproto => proto)
  • VSCode extension
    • TextMate grammar for syntax higlighting
    • Language server integration
  • Language Server
    • Diagnostics
    • Workspace support
    • Semantic token highlighting
    • Goto definition
    • Improve diagnostics with relatedInfo
    • Refactor LSP
    • Find references
    • Rename symbol

About

Custom extended protocol buffer compiler

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published