On Friday, November 2, 2018 at 6:44:27 PM UTC-4, Michael Powell wrote: > > > > On Wednesday, October 31, 2018 at 1:17:46 PM UTC-4, Adam Cozzette wrote: >> >> I think that specification has suffered a little bit of neglect (sorry >> about that), because in practice our C++ parser is really the de facto >> standard and we have not recently made an effort to go through and make >> sure the official spec matches it perfectly. My reading of that string >> (/[^\0\n\\]/) is that it's a regular expression saying "any character other >> than null, newline, or backslash." But in general I would say the best bet >> is to resolve ambiguities by looking at what the C++ parser does. >> > > I have a bit of an AST problem, I wonder if you have some C++ insight to > help sort it out. If I translate the grammar on its face to an AST via the > parser rules, I end up with a MessageBody that must be forward declared, in > C++ parlance, for use in both Group and Message. Does that sound about > right? There are probably ways around that, such as introducing AST > pointers, things of this nature; a bit beyond the scope of this discussion, > but, assuming Boost Spirit would be able to handle that? (TBD via > Boost/Spirit forums.) >
FYI, https://wandbox.org/permlink/WeRqkmDR93Wqu8BI > Provided my internal AST works, that's really all I need, to navigate it > and generate code given that. > > By the way, have you considered just reusing the C++ parser that's >> included in protoc? You can call protoc with the --descriptor_set_out flag >> to have it parse your .proto file and produce a serialized >> FileDescriptorSet proto as output. Then at that point it's easy to parse >> the descriptors using just about any language we support, and that should >> give you all the information you need, without the need for a new .proto >> file parser. >> > > I'm considering this as an approach, but I am a bit confused as to the > starting point. It seems like it all starts "compiling" the proto .protos > into the plugin implementation language, i.e. C++? Or perhaps I am missing > something? Also, do I need to have the source aligned with the protoc > version also readily available? i.e. with requisite libs, includes, etc? > Seems like possibly yes. > > Getting past the sort of "getting started" baby steps, it seems > straightforward enough to receive the compiler request, navigate the protoc > metadata API, and return a response. It's the getting past part that I'm > not exactly certain what the starting point really is. > > On Wed, Oct 31, 2018 at 9:23 AM Michael Powell <[email protected]> wrote: >> >>> On Wed, Oct 31, 2018 at 12:22 PM Michael Powell <[email protected]> >>> wrote: >>> > >>> > Concerning Constant, literally from the v2 spec: >>> >>> Rather, Syntax section, excuse me... >>> >>> > syntax = "syntax" "=" quote "proto2" quote ";" >>> > >>> > Do I read that correctly you can expect either 'proto2' or "proto2", >>> > but never 'proto2" nor "proto2' ? >>> > >>> > If accurate, that just seems to me to be lazy spec authorship... >>> > >>> > Thanks! >>> > On Wed, Oct 31, 2018 at 12:07 PM Michael Powell <[email protected]> >>> wrote: >>> > > >>> > > Hello, >>> > > >>> > > I am writing a parser for the Proto language specification starting >>> > > with v2. I need a little help interpreting one of the lines if you >>> > > please: >>> > > >>> > > In the "String literals" section, what does this mean: >>> > > >>> > > charValue = hexEscape | octEscape | charEscape | /[^\0\n\\]/ >>> > > >>> > > Specifically, the trailing list of character soup? I want to say that >>> > > there are escaped characters in the sequence? Or am I to take that >>> > > string literally? Or notwithstanding the enclosing forward slashes? >>> > > >>> > > Thanks much in advance! >>> > > >>> > > Best regards, >>> > > >>> > > Michael Powell >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Protocol Buffers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/protobuf. >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
