| Deutsch English Français Italiano |
|
<vh5q52$6gk9$1@solani.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!news.swapon.de!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Mild Shock <janburse@fastmail.fm> Newsgroups: comp.lang.prolog Subject: Mode yfy to the rescue (Was: How Prolog became an education nightmare) Date: Thu, 14 Nov 2024 22:30:11 +0100 Message-ID: <vh5q52$6gk9$1@solani.org> References: <db903ba2-8ccd-418e-bd18-a9eb381cd222n@googlegroups.com> <e5616850-37a8-46fd-b2a8-e3ca252b8a5an@googlegroups.com> <vgvsb7$3e31$1@solani.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Thu, 14 Nov 2024 21:30:10 -0000 (UTC) Injection-Info: solani.org; logging-data="213641"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19 Cancel-Lock: sha1:a/fSziPELg1CwSKnp4KP4T8FX+Y= X-User-ID: eJwNxckRwDAIBLCWILCsXQ7D0X8Jjj6ChUbRA+FYbG4Iss2K6pza6mnduUoqMIEpGq1X5BwPHZHvkPlHz/sAYiAVBQ== In-Reply-To: <vgvsb7$3e31$1@solani.org> Bytes: 2809 Lines: 59 Ok, here is my minimal test case, to demonstrate that fy 2 yf has not much practical use. Irrespective how it is parsed. The test case is the computer science professor who wants to teach compiler construction, and defines a toy language that has among other things a Pascal begin end: :- op(1100, fy, begin). :- op(1100, yf, end). Neither SWI-Prolog nor SICStus Prolog can parse this: ?- X = (begin x=1 end; begin y=2 end). ERROR: Syntax error: Operator priority clash I am also not able to parse it in Dogelog Player, Trealla Prolog and Scryer Prolog. I guess it has to do that disjunction uses xfy mode. Mostlikely yfx mode would also not help? What would help if there were a yfy mode (sic!). Mild Shock schrieb: > Concerning the input (xxx yyy zzz) the OP wrote: > > I would expect it to print zzz(xxx(yyy)). > > Where did he get this requirement from, he didn’t > compare other Prolog systems, right? So it came from > his applicationdomain. But what was his application > > domain? Ok, lets proceed to an example with multiple > brakets. Lets make the Pascal “begin” “end” example, > by replacing xxx and zzz by “begin” and “end”. > > I get this result: > > ?- member(X,[begin,end]), current_op(Y,Z,X). > X = (begin), Y = 1100, Z = fy ; > X = (end), Y = 1100, Z = yf. > > ?- X = (begin > | x = 1; > | y = 2; > | begin > | z = 3 > | end > | end). > X = (begin x=1;y=2;begin z=3 end end). > > But is the abstract parse term, the Prolog result useful? >