Yes circular dependencies are possible and it works.

For example

message Tree {
  message InnerNode {
    Tree left = 1;
    Tree right = 2;
  }
  oneof leaf_or_node {
    int leaf = 1;
    InnerNode node = 2;
  }
}

is a valid and useful protobuf to store binary trees.

On Monday, July 18, 2016 at 10:25:41 AM UTC-7, Alan Thomas wrote:
>
> In the EBNF grammar for protocol buffers 3 (), there are circular 
> references. 
>
> For example, message refers to messageBody, but messageBody refers back to 
> message. Unless I am missing something, this won`t work! 
>
> I was trying to implement the grammar using the python pyparsing package 
> and noticed this. Has someone already done this? 
>
> message = "message" messageName messageBody
> messageBody = "{" { field | enum | message | option | oneof | mapField |
> reserved | emptyStatement } "}"
>
>

-- 
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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to