EBNF - Allow full restriction management with except-symbol "-"

+1 vote
asked Oct 11, 2022 in Wanted features by The-Lu (64,340 points)

Hello PlantUML team,

  • Could you allow all full restriction management with except-symbol "-"?
     [perhaps with a 'not' management]

Here is some examples (taken from the ISO EBNF standard):

1/ OK:

@startebnf
title Second example of §5.8 Syntactic-term of ISO-EBNF
ee = {"A"}-, "E";
@endebnf

2/ Wanted feature:

@startebnf
title First example of §5.8 Syntactic-term of ISO-EBNF

letter = "A" | "B" | "C" | "D" | "E" | "F"
 | "G" | "H" | "I" | "J" | "K" | "L" | "M"
 | "N" | "O" | "P" | "Q" | "R" | "S" | "T"
 | "U" | "V" | "W" | "X" | "Y" | "Z" ;

vowel = "A" | "E" | "I" | "O" | "U";

consonant = letter - vowel;
@endebnf

Thanks for your works,
Regards.

related to an answer for: Could we add syntax diagrams?

1 Answer

0 votes
answered Oct 11, 2022 by plantuml (295,000 points)

About the second point, the big question is how to draw this?

Any existing example of image with such a diagram?

Thanks!

commented Oct 11, 2022 by Todd Musheno (2,680 points)

I am not against complying to the iso spec, but, I am not sure how to diagram this, op is talking about Syntactic-terms... from the spec:

5.8 Syntactic-term

When a syntactic-term is a single syntactic-factor it represents any sequence of symbols represented by that syntactic-factor.
When a syntactic-term is a syntactic-factor followed by an except-symbol followed by a syntactic-exception it represents any sequence of symbols that satisfies both of
the conditions:

a) it is a sequence of symbols represented by the syntactic-factor,
b) it is not a sequence of symbols represented by the syntactic-exception.
As examples the following syntax-rules illustrate the facilities provided by the except-symbol.
letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M"
| "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
vowel = "A" | "E" | "I" | "O" | "U";
consonant = letter - vowel;
ee = {"A"}-, "E";

Terminal-strings defined by these rules are as follows:

  • letter: A B CDEFGHIJ etc.
  • vowel: A EIOU
  • consonant: B C DFGHJKLM etc.
  • ee: AE AAE AAAE AAAAE AAAAAE etc.

NOTE — {"A"}- represents a sequence of one or more A’s because it is a syntactic-term with an empty syntactic-exception.

commented Oct 11, 2022 by Todd Musheno (2,680 points)
I think for a first draft, full iso compliance may NOT be required.

I am also reading the iso spec, I think this thing may be strictly used in sets of terminals... could be wrong though.
commented Oct 11, 2022 by Todd Musheno (2,680 points)
It could look something like, just an idea... and an X instead of + to denote negation maybe:

https://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKhEIImkLiX9BIb9BLAeheNoa_FpYlFp4lDA449b-UKv81v2IbVN3ggHImCkgWCLqbJGqzC6Q-9oICrB0Le50000

@startuml
class letter {}
class consonant {}
class vowl {}
consonant --> letter
(consonant, letter) ..+ vowl
@enduml
commented Oct 11, 2022 by The-Lu (64,340 points)

Hello PlantUML team,

On a first starting point, we can see the below example :

  • gap free symbol
  • first terminal char
  • second terminal char
  • commentless-symbol
  • special-sequence-char

on:

[As I first mentioned with 'perhaps with a 'not' management' wink]

See elsewhere for another example...
To search...

Regards,
Th.

commented Nov 8, 2022 by Todd Musheno (2,680 points)
What he said only us a symbol instead of the text "not"
commented Dec 4, 2022 by The-Lu (64,340 points)

Hello PlantUML team,

Could you have a look on this...
Example taken from:

And then this will end all the first ISO EBNF features... wink

Here is a proposal:

@startebnf
title First example of §5.8 Syntactic-term of ISO-EBNF

(* A proposal for a drawing of
<code>
consonant = letter - vowel;
</code>*)
'consonant = letter - vowel;

consonant-proposal = not, vowel, (letter);
consonant-proposal = 'not', vowel, (letter);
@endebnf

  • Change perhaps the box around, and the color of the `not` box?
  • Make perhaps a big box around all the negative object?
    Especially if there are several negative object... and also around the positive object!

Then the question will be on the group, if we can have:

@startebnf
title Test of except-symbol
a = (xx, yy) - (zz, tt);
@endebnf

Thanks for your works,
Regards.

commented Dec 13, 2022 by The-Lu (64,340 points)

Hello PlantUML team,

  • Is it make sense?
  • Would this be possible?
    at least for 1 block on either side of the minus sign...

Regards.
Th.

...