brucou / slim

Compiles a Kingly state machine drawn with the professional graph editor yEd
4 stars 0 forks source link

Syntactic rules to precise #1

Closed brucou closed 4 years ago

brucou commented 4 years ago

I fall upon some issues when compiling the RealWorld conduit app graph. The issue stems from the fact that one edge label is [\'#/article/:slug\' route] and I forbid the character / to be more than once in edge labels. This is to avoid ambiguity when parsing edge labels.

For instance, [\'#/article/:slug\' route] / doThis could be understood as either of:

The second makes obviously no sense.

The idea is to find a solution that is user-friendy and not ambiguous, but still allows several slashes. Also the program fails in that case, as it should but it is hard to find the errors amogn the pile of errors that is generated. I should document that errors are accumulated and that the first error shown should be solved first, as the following errors may be the result of the previous one.

One solution could be:

edgeLabel :bnf: = event | event [guard] | event [guard] / action | [guard] | [guard] / action | / action | event :bnf: = [:alphanumerical:] hopefully that includes the relevant unicode chars guard: anything except [ or ] action: anything except / [ ]

anything is any printable characters that can be entered with a keyboard.

brucou commented 4 years ago

Using a proper EBNF grammar now as source of truth