首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >语法错误:期望操作符

语法错误:期望操作符
EN

Stack Overflow用户
提问于 2011-01-08 16:28:23
回答 1查看 3.5K关注 0票数 2

我对我的Prolog program..it有问题,但是我不知道它是什么,is..can,有人给了我如何解决它的想法?错误从“症状”行开始,以下是我的代码:

代码语言:javascript
复制
go:-
   write('insert patient name'),nl,
   read(Patient),nl,Patient=Patient,
   hypothesis(Patient,Disease),
   write(Patient),('probably has'),write(Disease),nl.
go:-
   write('sorry,the disease'),nl,write('cannot be diagnosed'),nl.

symptom(Patient,abdominal pain):-
   write('does'),write(Patient),
   write('have abdominal pain y/n'),read(Reply),
   Reply=y,nl.
symptom(Patient,fever):-
   write('does'),write(Patient),write('have a fever (y/)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,blood or mucus in stool):-
   write('does'),write(Patient)write('have blood or mucus in stool(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,nausea and vomiting):-
   write('does'),write(Patient)write('have nausea and vomiting (y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,diarrhea):-
   write('does'),write(Patient)write('have diarrhea (y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,leg cramp):-
   write('does'),write(Patient)write('leg cramp(y/n)?'),
   read(Reply),
   Reply=y,nl.    
symptom(Patient,abdominal cramp):-
   write('does'),write(Patient)write('have abdominal cramp(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,cold skin):-
   write('does'),write(Patient)write('have cold skin (y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,weak pulse):-
   write('does'),write(Patient)write('have weak pulse(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,voice change):-
   write('does'),write(Patient)write('have voice change(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,sea sickness):-
   write('does'),write(Patient)write('have sea-sickness(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,upset stomach):-
   write('does'),write(Patient)write('have upset stomach(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,feeling green around the gill):-
   write('does'),write(Patient)write('have feeling green around the gill(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,weakness):-
   write('does'),write(Patient)write('have weakness(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,flu like symptom):-
   write('does'),write(Patient)write('have flu-like symptom(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,fatigue):-
   write('does'),write(Patient)write('have fatigue(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,intestinal pain):-
   write('does'),write(Patient)write('have intestinal pain(y/n)?'),
   read(Reply),
   Reply=y,nl.
symptom(Patient,straining at stool):-
   write('does'),write(Patient)write('have straining at stool(y/n)?'),
   read(Reply),
   Reply=y,nl.

hypothesis(Patient,chorela):-
   symptom(Patient,diarrhea),
   symptom(Patient,vomiting),
   symptom(Patient,leg cramp),
   symptom(Patient,cold skin),
   symptom(Patient,weak pulse),
   symptom(Patient,voice change).
hypothesis(Patient,gastroenteritis):-
   symptom(Patient,vomiting),
   symptom(Patient,nausea),
   symptom(Patient,diarrhea),
   symptom(Patient,sea sickness),
   symptom(Patient,upset stomach),
   symptom(Patient,feeling green around the gill),
   symptom(Patient,abdominal pain),
   symptom(Patient,weakness),
   symptom(Patient,flu like symptom),
   symptom(Patient,fatigue),
   symptom(Patient,blood or mucus in stool).
hypotesis(Patient,shigellosis):-
   symptom(Patient,diarrihea),
   symptom(Patient,fever),
   symptom(Patient,nausea),
   symptom(Patient,vominting),
   symptom(Patient,abdominal pain),
   symptom(Patient,intestinal pain),
   symptom(Patient,straining at stool),
   symptom(Patient,blood or mucus in stool).
EN

回答 1

Stack Overflow用户

发布于 2011-01-08 16:52:21

定义症状/2的第一行在第二个参数中有一个空白。也许您的意思是有一个原子“腹痛”,但正如所写,解析器将看到两个原子,腹部和疼痛,而不知道您的意思。

补充道:同样的“嵌入空白”错误出现在S症状/2的大多数子句的头上,也出现在调用症状的假设/2的子句正文中。还请注意该谓词的最后一句中“假设”的拼写错误。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4634867

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档