Is `---ident` a syntactically valid expression?
As per the language specification, both
- are reserved as operators. This should also mean that the string
---ident is lexically correct and should be lexed as:
-- - identifier ident EOF
However, the decrement unary operator
-- is not included in the MiniJava syntax grammar (for the purposes of the syntax grammar, it would be a single terminal symbol). As I understand it, this also means that a syntactically valid MiniJava program cannot contain
--, at least in case it was lexed as
--, or Java's decrement operator. Is this the correct interpretation of the language specification?
If it is, I think the
syntax/operators.mj testcase should be marked as invalid as it contains the following statement
(!---!-!!!!!-42 && x + 5 != y || 42 == 13 * 4 = x / 42 % z - 576 <= 18 > 11 + 3--4).method2(3+4, false, null);
The corresponding lexer output includes
-- as it starts with
( ! -- - ! […]
The same question arises for some of the testcases included in !23 (merged), namely