错误:9:42:语法错误:运算符应为prolog



因此,我正试图为我的prolog任务创建一个微世界,每当我试图查阅.pl文件时,它都会给我一堆错误,这些错误基本上都是以"quot;错误:softwares_and_hardwares.pl:9:42:语法错误:需要运算符"quot;在下一行中,相同的数字发生了变化。有人能帮我找出错误吗?求你了,谢谢你。下面是以下知识库的KB代码。

% File: softwares_and_hardwares.pl
% Line: casualling differentiating on various types of software and hardwares of the computers.
% ------------------------------------------------------------------------------------
% Predicates based on facts and knowledge  ...
% ------------------------------------------------------------------------------------
% software(sfname(S),typeofsf(T),Accesstosrc(A),licensefee(L) :: S is the name of the software where T is determined as which type of software and A as if it the sources is accessible to everyone and L is license fee (if any)
software(sfname(MacOS),typeofsf(Operating System software),Accesstosrc(No-its Proprietory Software),licensefee(paid-when buying the PC)).
software(sfname(Linux),typeofsf(Operating System software),Accesstosrc(Yes-its open-source Software),licensefee(free-easily available on internet)).
software(sfname(Avast Security),typeofsf(Security Application software),Accesstosrc(No-its Proprietory Software),licensefee(paid-subsicrption due after every certain period of time)).
software(sfname(Mozilla Firefox),typeofsf(Web Application software),Accesstosrc(Yes-its open-source Software),licensefee(free-easily downloadable from the internet)).
% hardware(hdname(H),typeofhd(D),hdtype(P)) :: H is the name of the hardware used in the computers where D is deteremined as which type of hardware and P as if the hardware is an external or internal type of device.
hardware(hdname(Printer),typeofhd(Output Device),hdtype(external)).
hardware(hdname(RAM-Random Access Memory),typeofhd(Internal component),hdtype(internal drive)).
hardware(hdname(Keyboard),typeofhd(Input Device),hdtype(external)).
hardware(hdname(PCI-Peripheral Component Interconnect aka USB ports),typeofhd(Input Device),hdtype(Internal)).
% Predicates based on Rules (indirectly on the above stated commands)...
% ------------------------------------------------------------------------------------
% Rules for listing softwares and hardwares and Computer-components
%------------------------------------------
% softwares :: all those items listed are softwares
softwares :- software(Name,_,_,_), write(Name), nl, fail.
softwares.
% hardwares :: all those items listed are hardwares
hardwares :- hardware(Name,_,_), write(Name), nl, fail.
hardwares.
% computer-components :: all those items listed are computer-components
computer-components :- softwares, hardwares.
% Rules for finding special components of the computer
%------------------------------------------
% Keyboard(Name) :: Name is a external hardware
Keyboard(Name) :- hardware(Name,_,hdtype(external)).
% Linux(Name) :: Name is a operating system software.
Linux(Name) :- software(Name,typeofsf(Operating System software),_,_).
% Mozilla Firefox(Name) :: Name is a web application software
Mozilla Firefox(Name) :- software(Name,typeofsf(Web Application software),_,_).
% Printer(Name) :: Name is a output device
Printer(Name) :- hardware(Name,typeofhd(output device),_).
% MacOS(Name) :: Name is a opertaing system software
MacOS(Name) :- software(Name,typeofsf(Operating System software),_,_).
% RAM-Random Access Memory(Name) :: Name is a internal component.
RAM-Random Access Memory(Name) :- hardware(Name,typeofhd(Internal component),_).
% Avast Security(Name) :: Name is a security application software
Avast Security(Name) :- software(Name,typeofsf(Security Application software),_,_).
% PCI-Peripheral Component Interconnect aka USB ports(Name) :: Name is a internal hardware.
PCI-Peripheral Component Interconnect aka USB ports(Name) :- hardware(Name,_,hdtype(internal).
%------------------------------------------```

在第8行(注释后的第一行代码(上,您有这个

Operating System software
No-its Proprietory Software
paid-when buying the PC

这不是Prolog代码。我可以想象,你会错过每一个";事物";。

最新更新