Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How would you encode a protocol with Tree Notation?

If you specify the fields and hierarchy with Tree Notation or YAML or JSON or EBNF or whatever, that's a starting point which can help with implementation the communication and data storage part. But you still need to write code for each language and each protocol right? Or can we encode the protocol-handling code using Tree Notation also?

I have always felt like web assembly was missing a well-defined system for extending the API and also a strong external module system. Or even if you could not extend the API much, if WASI had UDP, and there was a good WASM module distribution system, that seems like a way that one could distribute protocols.

But also Ethereum 2 seems like a decent way to distribute protocols.



> How would you encode a protocol with Tree Notation?

I am not 100% sure I understand your question because the word "protocol" can mean slightly different things in different contexts, but one possible answer is that there is a grammar language (called Grammar—https://jtree.treenotation.org/designer/#standard%20grammar), in which you can define new languages/protocols.

> But you still need to write code for each language and each protocol right?

Today, yes. And this is a very good question because something that is coming up a lot more now. Increasingly I am getting messages from people building new Tree Notation libraries in different host languages. The problem is people quickly get the basic structure done (pretty much just nested spreadsheets), and then are like "okay what next? how do I add support for the higher level tree languages". So that is becoming the top priority to figure out. Do we make a universal Grammar language that then is implemented in all host targets (JS, C, C#, Kotlin, Swift, GoLang, Java, Closure, Haskell, Python, etc) so that people can define a language (or "protocol") in this Grammar language and then generate get parsers/compilers in any of those community supported host languages? That seems like a likely path, but a lot to figure out there.

> I have always felt like web assembly was missing a well-defined system for extending the API and also a strong external module system.

I agree! I've been wanting to write a Grammar for a simple Tree Language that compiles to WASM for years but just haven't found the time (https://github.com/treenotation/research/issues/7).

If anyone wants to explore that space, happy to help!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: