gprolog
gprolog copied to clipboard
GNU Prolog Parser accepts incomplete clause.
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).