Some symbols in Scala 3 Syntax Summary?


In Scala 3 Syntax Summary, there are parentheses “()”,square brackets"[]" and curly braces("{}" used, like

UnicodeEscape ::= ‘\’ ‘u’ {‘u’} hexDigit hexDigit hexDigit hexDigit ;
hexNumeral       ::=  ‘0’ (‘x’ | ‘X’) hexDigit [{hexDigit | ‘_’} hexDigit] ;

“[]” might be similar to that in regular expression, but why is it (‘x’ | ‘X’), not [‘x’ | ‘X’]? “{}” is not understood at all, maybe repeat 0 to n times?

So what does these symbols mean?

Thanks for your help!


Take a look here Extended Backus–Naur form - Wikipedia

1 Like