Open Jean-Luc-Picard-2021 opened 2 weeks ago
Trealla is too lenient. We have:
6.3.1.3 Atoms ... An atom which is an operator shall not be the immediate operand (3.120) of an operator.
GNU Prolog also correctly raises a syntax error in this case.
Its not implemented by most Prolog systems. Mostlikely for performance reasons, since it would require an operator table lookup for each atom:
An issue for this is already filed for Tau Prolog: https://github.com/tau-prolog/tau-prolog/issues/286.
But Tau Prolog is dead now, or hibernating for more than 12 months already. So the more lenient behaviour has already been ossified in this Prolog system.
Another argument not in favor, it also makes parsing more non-monotonic, if you introduce the "shall" condition, because its a negative parsing condition.
$ target/release/scryer-prolog
?- X = (#\/ = #\/).
X = (#\/ = #\/).
?- use_module(library(clpz)).
true.
?- X = (#\/ = #\/).
error(syntax_error(incomplete_reduction),read_term/3:1).
Maybe introducing more than rather less operator table dependencies in a grammar is always a mistake? A further use case is (!)/1 in TPTP syntax.
Why cant Scryer Prolog parse this?
On the other hand Trealla Prolog has no problem:
What LEX / YACC did they use?