trealla-prolog / trealla

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

Parsing priority issue #593

Closed flexoron closed 2 weeks ago

flexoron commented 2 weeks ago
$ scryer-prolog -f
?- op(1,fy,'.').
   true.
?- X = '.'1.
   X = '.' 1.
?- X = .1.    % Operator first if operator,
   X = '.' 1.
?- op(0,fy,'.').
   true.
?- X = .1.    % otherwise syntax error
   error(syntax_error(incomplete_reduction),read_term/3:1).
?- halt.

%%%

$ tpl
?- op(1,fy,'.').
   true.
?- X = '.'1.
   X = .1.  % Unexpected because:
?- X = .1.
Error: syntax error, parsing number1, user:1
?- 
flexoron commented 2 weeks ago
?- X = .1.2.
   X = '.'  1.2. % seems fixed but
?- X = '.'  1.2.
Error: syntax error, missing operand to infix, user:1