There are always rumors that the ISO core standard syntax
is ambiguous. But its rather the other way around. The ISO
core standard explicitly says its not ambigious:
But the given example is misunderstood as requirement
of a parse that nevertheless needs a lot of lookahead. Why
is this example misunderstood?
Well its an impossible example, so therefore I think its
a negative example and not a positive example. There are no
yf_or_yfx operators in ISO core standard Prolog. Since among the
constraints for multiple operators is the following constraint:
Unfortunately SWI-Prolog doesn’t implement the constraint.
I can do:
/* SWI-Prolog (threaded, 64 bits, version 8.5.8) */
?- op(400,yf,f).
true.
?- op(400,yfx,f).
true.
What would be a usecase for such an operator? I
tryed the example from ISO core standard, but it
doesn’t work 100% as is stated in the ISO core standard.
If I use same priority, its not parsable:
?- op(400,fy,g).
true.
?- op(400,yf,g).
true.
?- X = r f g s, write_canonical(X).
ERROR: Syntax error: Operator priority clash
?- X = r f g g, write_canonical(X).
ERROR: Syntax error: Operator priority clash
If I use lower priority, it gives a different resulting term:
?- op(300,fy,g).
true.
?- op(300,yf,g).
true.
?- X = r f g s, write_canonical(X).
f(r,g(s))
X = r f g s.
?- X = r f g g, write_canonical(X).
f(r,g(g))
X = r f g (g).
Edit 06.04.2022:
I tried a few other Prolog systems, like Tau Prolog and
Scryer Prolog, they all implement the constraint:
?- op(400,yf,f).
true.
?- op(400,yfx,f).
caught: error(permission_error(create,operator,f),op/3)