On 5. Mar 2019, at 19:06, HenrikNergaard5 <h_n91@hotmail.com> wrote:
Hi Holger,
My plan of action is to start with a protobuf compiler/model and then look into binding the gRPC C implementation to Pharo.
I have an almost complete parser and compiler (class generation) implementation of protobuf in Pharo around somewhere... I cant quite remember the state of it, but I think everything is implemented parsing wise expect the gRPC part.
Instead of using slots the compiler generates accessor methods for each variable, initialization, custom encoding and decoding based on its message definition.
That would be good timing. I have hand created enough descriptions to be able to materialize the descriptor.proto (the model definition in itself) and class generation is next. I have experimented (by using the right super class) with automatic selector creation and I think it will work if tweaked to handle collections/repeated fields correctly. A class/type definition currently reads as: PBTypeMessage subclass: #GBPFieldDescriptorProto slots: { #name => (PBTypeString asSlot fieldName: 'name'; fieldNumber: 1; beOptional). #extendee => (PBTypeString asSlot fieldName: 'extendee'; fieldNumber: 2; beOptional). #number => (PBTypeInt32 asSlot fieldName: 'number'; fieldNumber: 3; beOptional). #label => (GBPFieldDescriptorProto_Label asSlot fieldName: 'label'; fieldNumber: 4; beOptional). #type => (GBPFieldDescriptorProto_Type asSlot fieldName: 'type'; fieldNumber: 5; beOptional). #type_name => (PBTypeString asSlot fieldName: 'type_name'; fieldNumber: 6; beOptional). #default_value => (PBTypeString asSlot fieldName: 'default_value'; fieldNumber: 7; beOptional). #options => (GBPFieldOptions asSlot fieldName: 'options'; fieldNumber: 8; beOptional). #json_name => (PBTypeString asSlot fieldName: 'json_name'; fieldNumber: 10; beOptional) } classVariables: { } package: 'Protobuf-Compiler-Definitions'
i can probably dig it up and make it publicly available if it is of interest.
That would be helpful!
Best regards, Henrik
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html