[noise] Machine-readable pattern list

Trevor Perrin trevp at trevp.net
Tue Oct 4 23:01:34 PDT 2016


On Tue, Oct 4, 2016 at 2:31 PM, Rhys Weatherley
<rhys.weatherley at gmail.com> wrote:
> I'd like the patterns to be provided in a
> machine-readable "patterns.txt" file in parallel with the specification.
> This will make it easier to bulk-convert patterns and to write analysis
> tools to validate patterns and apply transformations.  Sections 8.4 and 8.5
> in the specification list various properties - a tool would be better suited
> to generating that list, especially for new patterns.

Strongly agree (patterns in a text file, tools to work with them).


> As an example of the context-dependency, consider KN:
>
>     Noise_KN(s):
>        -> s
>        ...
>        -> e
>        <- e, ee, se
>
> This cannot be parsed with a straight-forward LL(1) parser because it is
> unclear whether the first "->" is introducing a pre-message or a message
> body until the "..." token is encountered later.  Might I suggest instead:
>
>     Noise_KN(s):
>        => s
>        ...
>        -> e
>        <- e, ee, se
>
> That is, use a different arrow marker for pre-messages.  Now the syntax is
> context-free.  Any off the shelf parser-generating tool can be used to
> create the parser.

Maybe, but if the only benefit here is that a tool that works with
text patterns can avoid scanning for "...", that's not that much of a
gain.

There's not that much cost to this proposal either.  But the visual
appearance would be a little messier (we're indicating the same
information 2 different ways).

Also, currently you can think of "->" and "<-" as arrows, rather than
text, and I've done this sometimes:

https://noiseprotocol.org/docs/noise_stanford_seminar_2016.pdf

With "=>" notation this isn't as easy - you'd need a fat and skinny
arrow, or an arrow with two tails?

I think a cleaner visual appearance for humans working with this might
be more important than saving tool developers from a (very small)
step?

Trevor


More information about the Noise mailing list