簡體   English   中英

錯誤:9:42:語法錯誤:操作員預期序言

[英]ERROR:9:42: Syntax error: Operator expected prolog

所以,我正在嘗試為我的 prolog 任務創建一個微世界,每當我嘗試查閱 .pl 文件時,它都會給我一堆錯誤,這些錯誤與它們以 ""ERROR:softwares_and_hardwares.pl:9 開頭的基本相同: 42: 語法錯誤: Operator expected"" 並且在下一行中,相同的數字發生了變化。 有人可以幫我找出錯誤嗎? 謝謝,麻煩您了。 下面是下面的知識庫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 代碼。 我可以想象您會錯過圍繞這些“事物”中的每一個的單引號/雙引號。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM