Formal grammar: SWIPL Example error handling

Warning! Long response…

The ISO core standad says the later cannot be, the plain argument is
wrong. Since :- is an operator, so it has level 1201, when you want it as
an atom. But :- is operator of priority 1200 with mode xfx, so neither the
left argument nor the right argument can be 1201:

Unbenannt

The only way to have it in an atom, is then in parenthesis:

You see the parenthesis, that would be required, in the SICStus Prolog output:

The ISO core standard also says the former cannot be, since the operator is fx.
:- x0 is an expression with a principal functor that is an operator of priority 1200,
so it cannot become an argument of an operator with priority 1200 and mode fx.
Since mode fx says the argument must be 1199:

Unbenannt6

Edit 13.04.2022:
The code I published, the parser I published here, doesn’t have
parenthesis parsing. Its a little simplified, but it also rejects the
input, but it does so by the second rule. There are multiple rules
that reject it, the rejection of :-(:- x0) and the rejection of :-(':-',x0).

Some third rule from the parser I published is the one token lookahead rule. If you
see :- you need to be able to immediately take it as fx, and then the error is
later a result of an operator clash, and not of a missing operator priority
override, as the parenthesis rule allows. What my simple parser can reject is

therefore :-(:- x0). Nevertheless the parser I published is a little bit
more tolerant than the ISO core standard. But it doesn’t give differently
built result terms, still the same as ISO core standard, also mostly the
same rejected as ISO core standard, a few more accepted.