Error de sintaxis: operador esperado

I have problem with my Prolog program..it seem to have error but i dont know what it is..can someone give me idea how to solve it??? the error starts from the line 'symptom' here are my code:

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).

preguntado el 08 de enero de 11 a las 16:01

Maybe you could share with us the line and column of the error as reported by the compiler? I'm not very fond of guessing. -

1 Respuestas

The first line that defines symptom/2 has a blank inside the explict 2nd argument. Perhaps you meant there to be a single atom 'abdominal pain', but as written the parser will see two atoms, abdominal and pain, and doesn't know what you mean.

Adicional: The same "embedded blank" error appears in the heads of most of your clauses for symptom/2, and in the bodies of clauses for hypothesis/2 where symptom is called. Also note the misspelling of "hypothesis" in your final clause for that predicate.

Respondido el 08 de enero de 11 a las 22:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.