Modifier Question in Java Grammar

The Java grammar states ModifiersOpt: { Modifier }. Modifierdefined as one of public, protected, private, static, etc ..... {x}denotes zero or more occurrences x.

We know that is public publicnot a valid identifier. Does this mean that any list item Modifier(e.g. public) appears only once in {Modifier}? Is there a "standard" parser combinator for { Modifier }?

+3
source share
2 answers

Not all errors in a Java program are syntax errors. For example, an error like this public privatemight (as you discovered) be considered a semantic error.

, , , ,

int i = "type error";

, Java.

+2

. aioobe, , public private, , . , , .

BNF-:

{x} x.

+2

Source: https://habr.com/ru/post/1786916/


All Articles