trealla-prolog / trealla

A compact, efficient Prolog interpreter written in plain-old C.
MIT License
268 stars 13 forks source link

Superflous parenthesis for fy mode #565

Closed Jean-Luc-Picard-2021 closed 2 months ago

Jean-Luc-Picard-2021 commented 2 months ago

Was using:

?- op( 600, fy, !).

?- current_op(X,Y,:).
   X = 600, Y = xfy

Just compare:

/* SWI-Prolog */
?- X = ![Y]:a.
X = ![Y]:a.

/* Trealla Prolog */
?- X = ![Y]:a.
   X = ! ([Y]:a).

Its from TPTP syntax. I think SWI-Prolog is correct in that it doesn't use parenthesis.

Jean-Luc-Picard-2021 commented 2 months ago

Scryer Prolog doesn't put parenthesis during ouput, but it has other issues with the bang (!) when it has a prefix definition:

/* Scryer Prolog */
?- X = ![Y]:a.
   X = ![Y]:a.

?- X = (!, b).
   error(syntax_error(incomplete_reduction),read_term/3:1).

Trealla does it fine:

/* Trealla Prolog */
?- X = (!, b).
   X = ((!),b).
infradig commented 2 months ago

Scryer is correct here in rejecting X = (!, b) & other Prologs are too lax.

EDIT: actually, i'll retract that statement.

On Sun, Jul 7, 2024 at 1:34 PM Jean-Luc-Picard-2021 < @.***> wrote:

Scryer Prolog doesn't put parenthesis during ouput, but it has other issues with the bang (!) when it has a prefix definition:

/ Scryer Prolog / ?- X = ![Y]:a. X = ![Y]:a.

?- X = (!, b). error(syntax_error(incomplete_reduction),read_term/3:1).

Trealla does it fine:

/ Trealla Prolog / ?- X = (!, b). X = ((!),b).

— Reply to this email directly, view it on GitHub https://github.com/trealla-prolog/trealla/issues/565#issuecomment-2212307942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFNKSEVJDCN6ZKOKS5LLZMTZLCZMZAVCNFSM6AAAAABKO7IBUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJSGMYDOOJUGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Jean-Luc-Picard-2021 commented 2 months ago

But Scryer Prolog is dead. Not a single code commit for 1 month.