简体   繁体   English

错误:9:42:语法错误:操作员预期序言

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

So, I am trying to create a microworld for my prolog assignment and whenever I try to consult the .pl file it gives me a bunch of errors which are basically all the same as they start with ""ERROR:softwares_and_hardwares.pl:9:42: Syntax error: Operator expected"" and in the next line, the same ones with the numbers changed.所以,我正在尝试为我的 prolog 任务创建一个微世界,每当我尝试查阅 .pl 文件时,它都会给我一堆错误,这些错误与它们以 ""ERROR:softwares_and_hardwares.pl:9 开头的基本相同: 42: 语法错误: Operator expected"" 并且在下一行中,相同的数字发生了变化。 Can someone help me figure out the error?有人可以帮我找出错误吗? Please and thank you.谢谢,麻烦您了。 Below here is the knowledge base KB code of the following.下面是下面的知识库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).

%------------------------------------------```

On line 8 (the first code line after the comments) you have this在第 8 行(注释后的第一行代码)你有这个

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

This is not Prolog code.这不是 Prolog 代码。 I can imagine that you miss single/double quotes around each of these "things".我可以想象您会错过围绕这些“事物”中的每一个的单引号/双引号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM