Spec Formalization: Human Readable Representation #11
Replies: 2 comments 5 replies
-
Having worked on this before way back when, I'd say that it is important that humans can easily produce (not just read) a text representation. Complex expression trees are very difficult to build by hand when using a graph of objects. I hate bringing in a parser but I don't really have any other ideas for how to make these human producible. When I did this before, I produced this antlr grammar. I'm sure it could be further simplified. I suggest people evaluating this try to explore a moderately complex query expression. FYI, when I first worked on the work linked above, I went all objects. It basically defeated the purpose of having something human readable/writable. As a note, another point that I've struggled with is the expression of functions. Since there can be many add() implementations with different input types. Because the spec is defined to be specific about the actual type binding of each function, it means that add() in text representation is not enough. Best idea I've come up with is add_argument_types such as add_ii(foo,bar) if you're adding two integers (or whatever makes sense for each type). |
Beta Was this translation helpful? Give feedback.
-
I'm all for having a human-readable representation, but it seems like adding one too early could easily side-track or delay the spec. I think serialization is less important because we can always come up with alternative serializations later. When we agree on what needs to be serialized, it is much easier to design how to do it. |
Beta Was this translation helpful? Give feedback.
-
In the short would it make sense to use protobuf's (or whatever binary format is chosen) as canonical text format for the human readable representation? It seems this would help ensure the IDL for both stays in sync while it goes through iterations. It also limits technologies that any library used to consume the spec needs to integrate with. The downside is not having some of the syntactic sugar of an ANTLR based grammar (although I suppose this could be integrated in protobuf as well, with something like custom annotations).
Beta Was this translation helpful? Give feedback.
All reactions