Error Operator Priority Clash
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Prolog operator priority up vote 3 down vote favorite The user input is given in the format a:b>c>d>e... and so on. I would like to parse the input into :(a,>(b,>(c,>(d,e))) would that be possible and is there any suggestion to do that? I tested with this prepare:- op(750,xfx,user:(:)), % change the default priority of : and > op(700,xfx,user:(>)), display(a: b > c),%this one worked fine and %the display value is :(a,>(b,c)) display(a: b > c > d ). % I cannot have this works, %the error ERROR: %Syntax error: %Operator priority clash is thrown. The input cannot be modified. Any suggestion is appreciate. Thanks! prolog operators iso-prolog share|improve this question edited Nov 24 '13 at 12:36 false 10.1k651107 asked Dec 29 '12 at 21:55 temp 10216 add a comment| 1 Answer 1 active oldest votes up vote 3 down vote accepted Maybe first and foremostly: Both (:)/2 and (>)/2 are already infix operators defined in the standard like so: :- op(600, xfy, :). % ISO/IEC 13211-2 5.2.1, table 1 :- op(700, xfx, >). % ISO/IEC 13211-1 6.3.4.4, table 7 Changing their priority means that you change their common meaning. This is very often not a good idea. Think of it: It's like you would (be able to) change the priority of operators in Java, C#, C++, Perl or PHP. They all did not dare to change the priority they inherited from C. But, strictly speaking, you are able to do this. To minimize the detrimental effect of such a change, try to keep the declaration in a module of your own. And, in a system without module-local operators, make sure you will recover to the original declarations safely. You wrote user:(>) which affects the special user-module. Instead, write your own module. ... or maybe reconsider the operator to be changed. Terms are read up to the next period in one fell swoop. So if you have a rule like you have shown, the operato
b :- c. Quoted from: http://www.groupsrv.com/computers/about124076.html Comment Even though I new to Prolog (this is my second program using it), I feel like I'll continue to make this mistake if I ever use Prolog again. Posted by FrustratedProgrammer at 23:42 Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest Labels: coding, prolog, swi-prolog No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) About Documenting my technical difficulties. Sometimes I'll post code snippets I've worked on. Blog Archive ► 2016 (9) ► August (1) ► June (2) ► April (1) ► February (4) ► January (1) ► 2015 (8) ► http://stackoverflow.com/questions/14086271/prolog-operator-priority December (2) ► November (1) ► October (2) ► September (1) ► July (1) ► March (1) ▼ 2014 (10) ► November (1) ► August (1) ► July (1) ► May (1) ► April (1) ▼ March (5) Problem #5: Prolog's "Out of local stack" Problem #4: Prolog is hiding part of my answer Problem #3: Prolog ignoring a predicate Problem #2: "Syntax error: Operator priority clash... Problem #1: "Prolog-Interpreter /bin/plwin.exe http://tryingtoprogram.blogspot.com/2014/03/problem-2-syntax-error-operator.html not... Labels Project Euler (4) coding (4) installation (4) swi-prolog (4) C++ (3) Ubuntu (3) programming teaser (3) C (2) GPU (2) Skype (2) debugging (2) finding a sum (2) gcc (2) linking (2) prime factors (2) prime numbers (2) program hanging (2) prolog (2) ssh (2) LLVM (1) LaTeX (1) Microsoft Office (1) Nvidia (1) Ocelot (1) OpenCL (1) Outlook.com (1) Ubuntu 14.04 (1) VirtualBox (1) XBMC (1) birthday (1) black screen (1) calendar (1) chromium (1) clock skew (1) compiling (1) default (1) delete (1) drivers (1) g++ (1) html (1) iframes (1) javascript (1) largest number (1) least common multiple (1) libclc (1) mistake (1) mixing languages (1) multi-threading (1) multiples (1) name mangling (1) order of operations (1) output (1) overflow (1) pause (1) printer (1) questions and answers (1) same-origin policy (1) security (1) shared folder (1) singleton lock (1) spin loop (1) ssh-keygen (1) stress test (1) symlink (1) undefined reference (1) visual studio (1) volume (1) wPrime (1) windows (1) About Me FrustratedProgrammer View my complete profile Blog Archive ► 2016 (9) ► August (1) ► June (2) ► April (1) ► February (4) ► January (1) ► 2015 (8) ► December (2) ► November (1) ► October (2) ► September (1)
clash I think you forgot http://computer-programming-forum.com/55-prolog/cf978763f9da43cb.htm to include the text of the error message. Quote: > Hi, > This morning swiprolog reported the above error message. As no > enlightenment is given in the Manual, could you please help me? > The error refers to a certain predicate error operator P that uses locally defined > predicates, that themselves call P. So, whether I place the > definition of P before or after the others it does not really > make any difference: I still get that error. But the thing was > error operator priority working fine, so it must be something else. > What is the real meaning of that message? > Sergio Sun, 25 Aug 2002 03:00:00 GMT Page 1 of 1 [ 1 post ] Relevant Pages 1. - colon operator (:) in SWI Prolog 2. - colon operator (:) in SWI Prolog 3. a2p syntax error on with string concatenation operator 4. Need SWI-Prolog.h for SWI 1.8.11 5. SWI-Prolog 5.0.10 packages compile (make install) error 6. SWI Prolog - error with "retract" 7. Any experience ? TCL name Clashing Issue 8. priority of an operator 9. operators priority (fortran 95) 10. SWI Prolog Vs GNU Prolog 11. Benchmarking of Trinc-Prolog, SWI-Prolog and VisualProlog(PDC) 12. Prolog IV to SWI-Prolog Powered by phpBB Forum Software