RamonMeffert / elm-gossip

A user-friendly web tool for exploring dynamic gossip.
https://r3n.nl/elm-gossip/
GNU General Public License v3.0
3 stars 0 forks source link

Custom protocol creation #7

Closed RamonMeffert closed 3 years ago

RamonMeffert commented 3 years ago

I.e. a way to combine constituents in the UI to create a protocol

RamonMeffert commented 3 years ago

When this is done, it might be a nice idea to integrate a way to simplify protocols (normal forms are probably useful for this). This would then also allow us to check whether a newly created protocol isn't just the same as an older one.

RamonMeffert commented 3 years ago

https://package.elm-lang.org/packages/annaghi/dnd-list/latest/

RamonMeffert commented 3 years ago

This'll also end up fixing #24 when I implement the package I mentioned above

RamonMeffert commented 3 years ago

(These are basically some notes for myself)

I have a rough draft for a drag-'n-drop system for boolean combinations of gossip protocol constituents that I think is pretty neat, but it needs:

Then, I need to convert the current predefined protocols to the new format.

Currently, I'm using the following type:

type BoolElement 
    = And
    | Or
    | Token Bool Constituent
    | Group Bool (List BoolElement)

The Bools are negation parameters, so Token True IsEmpty would mean σₓ = ϵ and Token False IsEmpty would mean σₓ ≠ ϵ (or ¬(σₓ = ϵ))

Based loosely on the following LL(1) grammar:

Expression   -> Token Expression'
Expression'  -> or Token Expression' | ε
Token        -> Final Token'
Token'       -> and Final Token' | ε
Final        -> Negation Final'
Negation     -> not | ε
Final'       -> ( Expression ) | constituent

Note that the use of Group makes parsing a lot easier. Also, by constraining the type and allowing only certain modifications in the interface, it should be possible to use the validation step to make sure parsing is possible, using a couple of relatively simple rules.

RamonMeffert commented 3 years ago

Plan for the showable version: Add a note saying that this is in progress w/ a link to (the cleaned up version of) a live version of the repository mentioned above, and include it in the query as a hypothetical