EBNF causes java.lang.IllegalStateException

0 votes
asked Jul 18, 2023 in Bug by Potherca (430 points)

To quote the Wikipedia:

Even EBNF can be described using EBNF. Consider below grammar (using conventions such as "-" to indicate set disjunction, "+" to indicate one or more matches, and "?" for optionality)


However, when I run the provided EBNF through PlantUML, I get:

You should send a mail to plantuml@gmail.com or post 
to https://plantuml.com/qa with this log 
(V1.2023.10beta2) java.lang.IllegalStateException

1 Answer

+2 votes
answered Jul 18, 2023 by The-Lu (64,300 points)
selected Aug 11, 2023 by Potherca
 
Best answer

Hello P., and all,

It is [currently] normal.
→ Because current implementation use only 'ISO EBNF' form.

Then:

@startebnf
concatenation = ( S , factor , S , "," ? ) + ;
@endebnf

is not a ISO BNF form!

You must use ISO EBNF:

The Wikipedia [simplified] grammar (using conventions)ISO EBNF
"+" to indicate one or more matches{ }- form
"?" for optionality[ ] form

Then here is the expected result:

@startebnf
concatenation = { S , factor , S , [","] }- ;
@endebnf


Or use RegEx, like:

@startregex
concatenation = (( S )( factor )( S ) ,?)+;
@endregex


See also doc. here:

If that can help,
Enjoy,

Regards,
Th.

commented Jul 22, 2023 by Todd Musheno (2,680 points)
I think we should look into common "extensions" like this at some point.
...