Hi There,
Working on the Erlang-Red and specifically an MQTT emulation flow, I noticed how simple yet complicate binary definitions in Erlang are:
<<_:8/bits, 1:1, Len:7/bits, 1:1, Len2:7/bits, 1:1, Len3:7/bits, 0:1, Len4:7/bits, Rest/bytes>>
which is great but which isn’t low-code - IMHO ![]()
So I’ve been looking into finding a more low-code representation and I happened across Packet which a NodeJS implementation of a representation. In Packet, the above would become:
x8,
x1 => 1,
b7 => len,
x1 => 1,
b7 => len2,
x1 => 1,
b7 => len3,
x1 => 0,
b7 => len4
which would generate a map with the keys:
#{ <<"len">> => ..., <<"len2">> => ..., <<"len3">> => ..., <<"len4">> => ... }
There is a corresponding Node-RED node - binary that implements the Packet specification as a node. As a comparison there is another Node-RED node that does more and is more popular but that I find too visual and too complicated –> node-red-contrib-buffer-parser.
Is there an alternative low-code representation? What I’m looking for is a representation that can be used by Node-RED and Erlang-Red, hence I don’t want to be using the Erlang binary matching since that’s too specific (sorry to say) and too hard to understand for non-Erlang folks.
I’ve created an initial implementation but if there is a better, existing solution, then I’m happy to switch to that.
Cheers & Many Thanks!