A tuprolog syntax error.Syntax error at/before line -1

末鹿安然 提交于 2020-01-07 02:27:07

问题


I am new to prolog. I have a .pl file consulting normally on swi-prolog, but when I consult it on tu-prolog, crazy things always happen. Here are parts of my codes.

    :- dynamic(assignopT/6).
    :- multifile(assignopT/6).
    assignopT(30246,30244,30210,30247,+,30248).

When I consulted it on tu-prolog,it said syntax error at/before line 12219,which is the third line above. It work all right on swi-prolog. Then I thought maybe there is something wrong with +, so I changed it to this.

    assignopT(30246,30244,30210,30247,'+',30248).

This time,it said syntax error at/before line -1. I really don't get this, what line -1 even suppose to mean. The .pl named swi2tu.pl is on https://drive.google.com/folderview?id=0B4KCEwRVmr_yWjQwOEp3LWpYdk0&usp=sharing


回答1:


Try instead:

assignopT(30246,30244,30210,30247,(+),30248).

Writing an atom, such as +, between single quotes changes nothing and the error is possibly due to its operator status. Assuming that's the case, writing it between ()'s should fix the possible operator conflict when loading the code in tuProlog (not Turbo Prolog, I assume!).



来源:https://stackoverflow.com/questions/17885518/a-tuprolog-syntax-error-syntax-error-at-before-line-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!