gprolog icon indicating copy to clipboard operation
gprolog copied to clipboard

GNU Prolog Parser accepts incomplete clause.

Open Jean-Luc-Picard-2021 opened this issue 1 year ago • 0 comments

I had this source code:

deadfish_(X, X) --> [o]. % Output always at the end
deadfish_(X0, X) -->
    { ops(Op, X0, X1) },
    [Op],
    deadfish_(X1, X).

But by accident I entered only, was using [user] consult and ^D:

deadfish_(X, X) --> [o]. % Output always at the end
deadfish_(X0, X) -->
    { ops(Op, X0, X1) },
    [Op],

My expectation was a syntax error, but listing shows me it parsed:

deadfish_(A, A, [o|B], B).
deadfish_(A, _, B, C) :-
	ops(D, A, _),
	B = [D|E],
	end_of_file(E, C).

Jean-Luc-Picard-2021 avatar Oct 09 '23 22:10 Jean-Luc-Picard-2021