Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

A language that doesn't affect the way you think about programming is not worth knowing.


devel / comp.lang.prolog / About the Operator '|' and the DCG Draft

SubjectAuthor
* About the Operator '|' and the DCG DraftMostowski Collapse
+* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|`* Re: About the Operator '|' and the DCG DraftMostowski Collapse
| `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  +* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  |`* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  | `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  |  `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  |   `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  |    `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  |     `- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|  `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|   `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|    `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|     `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|      `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|       `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|        `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|         `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|          `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|           `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|            `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|             `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|              `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|               +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|               +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|               +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|               +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|               +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|               `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 +- Re: About the Operator '|' and the DCG DraftMostowski Collapse
|                 `- Re: About the Operator '|' and the DCG DraftMostowski Collapse
`* Re: About the Operator '|' and the DCG DraftMostowski Collapse
 `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
  `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
   `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
    `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
     `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
      `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
       `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
        `* Re: About the Operator '|' and the DCG DraftMostowski Collapse
         `- Re: About the Operator '|' and the DCG DraftMostowski Collapse

Pages:123
About the Operator '|' and the DCG Draft

<27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1067&group=comp.lang.prolog#1067

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:1a08:: with SMTP id f8mr1263764qtb.94.1641846773670;
Mon, 10 Jan 2022 12:32:53 -0800 (PST)
X-Received: by 2002:a5b:3ce:: with SMTP id t14mr1689079ybp.361.1641846773325;
Mon, 10 Jan 2022 12:32:53 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 10 Jan 2022 12:32:53 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
Subject: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 10 Jan 2022 20:32:53 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 36
 by: Mostowski Collapse - Mon, 10 Jan 2022 20:32 UTC

Just dont use it for DCG. This here is much more better:

p --> q; r.
?- listing.

p(_0, _1) :- q(_0, _1); r(_0, _1).
true.

Works in Dogelog like that:
http://www.xlog.ch/izytab/moblet/en/docs/18_live/10_reference/example01/package.html

Rational: Ever tried to convert some ordinary code into
DCG? With (;)/2 reflected as (;)/4 in DCG, this is easy.
Just replace (:-)/2 by (-->)/2.

But now the DCG draft wants people to also change (;)/2
into (|)/4. What a nonsense, since (,)/2 reflects into (,)/4,
(->)/2 reflects into (->)/2 and !/0 reflects into !/2.

With the Dogelog approach all ISO control construct
reflect without any need for renaming. You can leave '|'
untouched and use it for TPTP Syntax side by side

with DCG. On the other hand the DCG Draft wants an
exception for the (;)/2 and reflect it into (|)/2, causing
infinitely many nonsense problems.

See also:

% operator definitions (TPTP syntax)

:- op( 500, fy, ~). % negation
:- op(1000, xfy, &). % conjunction
:- op(1100, xfy, '|'). % disjunction
:- op(1110, xfy, =>). % implication

https://www.philipzucker.com/javascript-automated-proving/

Re: About the Operator '|' and the DCG Draft

<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1068&group=comp.lang.prolog#1068

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a0c:f7ce:: with SMTP id f14mr1092916qvo.63.1641847518338;
Mon, 10 Jan 2022 12:45:18 -0800 (PST)
X-Received: by 2002:a25:287:: with SMTP id 129mr1890585ybc.670.1641847518071;
Mon, 10 Jan 2022 12:45:18 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 10 Jan 2022 12:45:17 -0800 (PST)
In-Reply-To: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 10 Jan 2022 20:45:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 74
 by: Mostowski Collapse - Mon, 10 Jan 2022 20:45 UTC

Now have drummed for DCG usage for the web. Only to notice that
the DCG Draft has made everything to make this not work. My point
of departure was Phil Zuckers mixture of Prolog and JavaScript.

I always thought there is an overselling of Prolog DCG. But somehow
there is an underselling when doing web stuff. Phil Zuckers example
using JavaScript for pretty printing is the worst thing I have ever

seen. If you search a proof tree via Prolog and then use JavaScript
to render it, you generate a hell of Problems:

- You need to assume some JavaScript representation of
the Prolog terms. In the case of Phil Zucker the TauProlog
this is just an arbitarily designed API. There is no such
standard for such APIs.
→ Your code is not portable.

- You need to do stuff in JavaScript that Prolog is much
better suited for. Like doing text generation, proof filtering
etc…, I wouldn’t want to do this in JavaScript.
→ Your code is not concise.

- When doing stuff in Prolog you have automatically
some flexible indexing, like first argument indexing. Also
Prolog has additional garbage collection. Things not
available in JavaScript.
→ Your code is not efficient.

- It might be prohibitive to call repeatedly Prolog
predicates during JavaScript rendering. So that
you might implement stuff twice, in Prolog and
in JavaScript.
→ Your code is not single source.

- What else?

Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 21:32:54 UTC+1:
> Just dont use it for DCG. This here is much more better:
>
> p --> q; r.
> ?- listing.
>
> p(_0, _1) :- q(_0, _1); r(_0, _1).
> true.
>
> Works in Dogelog like that:
> http://www.xlog.ch/izytab/moblet/en/docs/18_live/10_reference/example01/package.html
>
> Rational: Ever tried to convert some ordinary code into
> DCG? With (;)/2 reflected as (;)/4 in DCG, this is easy.
> Just replace (:-)/2 by (-->)/2.
>
> But now the DCG draft wants people to also change (;)/2
> into (|)/4. What a nonsense, since (,)/2 reflects into (,)/4,
> (->)/2 reflects into (->)/2 and !/0 reflects into !/2.
>
> With the Dogelog approach all ISO control construct
> reflect without any need for renaming. You can leave '|'
> untouched and use it for TPTP Syntax side by side
>
> with DCG. On the other hand the DCG Draft wants an
> exception for the (;)/2 and reflect it into (|)/2, causing
> infinitely many nonsense problems.
>
> See also:
>
> % operator definitions (TPTP syntax)
>
> :- op( 500, fy, ~). % negation
> :- op(1000, xfy, &). % conjunction
> :- op(1100, xfy, '|'). % disjunction
> :- op(1110, xfy, =>). % implication
>
> https://www.philipzucker.com/javascript-automated-proving/

Re: About the Operator '|' and the DCG Draft

<2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1069&group=comp.lang.prolog#1069

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:22ed:: with SMTP id p13mr1111628qki.768.1641847719668;
Mon, 10 Jan 2022 12:48:39 -0800 (PST)
X-Received: by 2002:a05:6902:723:: with SMTP id l3mr2090406ybt.378.1641847719450;
Mon, 10 Jan 2022 12:48:39 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 10 Jan 2022 12:48:39 -0800 (PST)
In-Reply-To: <6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com> <6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 10 Jan 2022 20:48:39 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 99
 by: Mostowski Collapse - Mon, 10 Jan 2022 20:48 UTC

Using DCG is not mandatory. You could also imagine a Prolog
only solution where this DCG here:

p --> ['foo bar'], q.

Is replaced by old CGI style web service:

p :- write('foo bar'), q.

You could also use something similar for client side, like Tau-
Prolog not only server side like for SWI-Prolog. Performance
depends on the stream that write/1 will use.

On the server side you could write into a buffer, and then serve
a HTTP request with a known length, or directly write into the
HTTP response socket and deliver the result chunked.

What I observed is that DCG is more handy for debugging. In
CGI style write/1, when you use it in the Prolog debugger, in
some console based debugger, the write/1 will constantly

flood the console, making it practically impossible
to sensibly debug the thingy.

Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 21:45:19 UTC+1:
> Now have drummed for DCG usage for the web. Only to notice that
> the DCG Draft has made everything to make this not work. My point
> of departure was Phil Zuckers mixture of Prolog and JavaScript.
>
> I always thought there is an overselling of Prolog DCG. But somehow
> there is an underselling when doing web stuff. Phil Zuckers example
> using JavaScript for pretty printing is the worst thing I have ever
>
> seen. If you search a proof tree via Prolog and then use JavaScript
> to render it, you generate a hell of Problems:
>
> - You need to assume some JavaScript representation of
> the Prolog terms. In the case of Phil Zucker the TauProlog
> this is just an arbitarily designed API. There is no such
> standard for such APIs.
> → Your code is not portable.
>
> - You need to do stuff in JavaScript that Prolog is much
> better suited for. Like doing text generation, proof filtering
> etc…, I wouldn’t want to do this in JavaScript.
> → Your code is not concise.
>
> - When doing stuff in Prolog you have automatically
> some flexible indexing, like first argument indexing. Also
> Prolog has additional garbage collection. Things not
> available in JavaScript.
> → Your code is not efficient.
>
> - It might be prohibitive to call repeatedly Prolog
> predicates during JavaScript rendering. So that
> you might implement stuff twice, in Prolog and
> in JavaScript.
> → Your code is not single source.
>
> - What else?
> Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 21:32:54 UTC+1:
> > Just dont use it for DCG. This here is much more better:
> >
> > p --> q; r.
> > ?- listing.
> >
> > p(_0, _1) :- q(_0, _1); r(_0, _1).
> > true.
> >
> > Works in Dogelog like that:
> > http://www.xlog.ch/izytab/moblet/en/docs/18_live/10_reference/example01/package.html
> >
> > Rational: Ever tried to convert some ordinary code into
> > DCG? With (;)/2 reflected as (;)/4 in DCG, this is easy.
> > Just replace (:-)/2 by (-->)/2.
> >
> > But now the DCG draft wants people to also change (;)/2
> > into (|)/4. What a nonsense, since (,)/2 reflects into (,)/4,
> > (->)/2 reflects into (->)/2 and !/0 reflects into !/2.
> >
> > With the Dogelog approach all ISO control construct
> > reflect without any need for renaming. You can leave '|'
> > untouched and use it for TPTP Syntax side by side
> >
> > with DCG. On the other hand the DCG Draft wants an
> > exception for the (;)/2 and reflect it into (|)/2, causing
> > infinitely many nonsense problems.
> >
> > See also:
> >
> > % operator definitions (TPTP syntax)
> >
> > :- op( 500, fy, ~). % negation
> > :- op(1000, xfy, &). % conjunction
> > :- op(1100, xfy, '|'). % disjunction
> > :- op(1110, xfy, =>). % implication
> >
> > https://www.philipzucker.com/javascript-automated-proving/

Re: About the Operator '|' and the DCG Draft

<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1070&group=comp.lang.prolog#1070

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:2aab:: with SMTP id js11mr1218384qvb.54.1641849320471;
Mon, 10 Jan 2022 13:15:20 -0800 (PST)
X-Received: by 2002:a25:c841:: with SMTP id y62mr2239846ybf.196.1641849320233;
Mon, 10 Jan 2022 13:15:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 10 Jan 2022 13:15:20 -0800 (PST)
In-Reply-To: <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 10 Jan 2022 21:15:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 122
 by: Mostowski Collapse - Mon, 10 Jan 2022 21:15 UTC

I dont know yet how much legacy will be destroyed by
adopting (;)/2 and only (;)/2. If I remember well some
Prolog system support both (|)/2 and (;)/2 in DCG?

Not sure. And not sure what the experts say.
Typically (|)/2 is rather rare, because for DCG there
is not so much the idiom as seen in syntax docu:

p --> "foo"
| "bar"
| "baz".

Since we want to parse something, and return
something. So although a syntax docu might read
as in the above, practically this often turns into:

p(ast1) --> "foo".
p(ast2) --> "bar".
p(ast3) --> "baz".

The DCG disjunction disappears!

Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 21:48:40 UTC+1:
> Using DCG is not mandatory. You could also imagine a Prolog
> only solution where this DCG here:
>
> p --> ['foo bar'], q.
>
> Is replaced by old CGI style web service:
>
> p :- write('foo bar'), q.
>
> You could also use something similar for client side, like Tau-
> Prolog not only server side like for SWI-Prolog. Performance
> depends on the stream that write/1 will use.
>
> On the server side you could write into a buffer, and then serve
> a HTTP request with a known length, or directly write into the
> HTTP response socket and deliver the result chunked.
>
> What I observed is that DCG is more handy for debugging. In
> CGI style write/1, when you use it in the Prolog debugger, in
> some console based debugger, the write/1 will constantly
>
> flood the console, making it practically impossible
> to sensibly debug the thingy.
> Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 21:45:19 UTC+1:
> > Now have drummed for DCG usage for the web. Only to notice that
> > the DCG Draft has made everything to make this not work. My point
> > of departure was Phil Zuckers mixture of Prolog and JavaScript.
> >
> > I always thought there is an overselling of Prolog DCG. But somehow
> > there is an underselling when doing web stuff. Phil Zuckers example
> > using JavaScript for pretty printing is the worst thing I have ever
> >
> > seen. If you search a proof tree via Prolog and then use JavaScript
> > to render it, you generate a hell of Problems:
> >
> > - You need to assume some JavaScript representation of
> > the Prolog terms. In the case of Phil Zucker the TauProlog
> > this is just an arbitarily designed API. There is no such
> > standard for such APIs.
> > → Your code is not portable.
> >
> > - You need to do stuff in JavaScript that Prolog is much
> > better suited for. Like doing text generation, proof filtering
> > etc…, I wouldn’t want to do this in JavaScript.
> > → Your code is not concise.
> >
> > - When doing stuff in Prolog you have automatically
> > some flexible indexing, like first argument indexing. Also
> > Prolog has additional garbage collection. Things not
> > available in JavaScript.
> > → Your code is not efficient.
> >
> > - It might be prohibitive to call repeatedly Prolog
> > predicates during JavaScript rendering. So that
> > you might implement stuff twice, in Prolog and
> > in JavaScript.
> > → Your code is not single source.
> >
> > - What else?
> > Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 21:32:54 UTC+1:
> > > Just dont use it for DCG. This here is much more better:
> > >
> > > p --> q; r.
> > > ?- listing.
> > >
> > > p(_0, _1) :- q(_0, _1); r(_0, _1).
> > > true.
> > >
> > > Works in Dogelog like that:
> > > http://www.xlog.ch/izytab/moblet/en/docs/18_live/10_reference/example01/package.html
> > >
> > > Rational: Ever tried to convert some ordinary code into
> > > DCG? With (;)/2 reflected as (;)/4 in DCG, this is easy.
> > > Just replace (:-)/2 by (-->)/2.
> > >
> > > But now the DCG draft wants people to also change (;)/2
> > > into (|)/4. What a nonsense, since (,)/2 reflects into (,)/4,
> > > (->)/2 reflects into (->)/2 and !/0 reflects into !/2.
> > >
> > > With the Dogelog approach all ISO control construct
> > > reflect without any need for renaming. You can leave '|'
> > > untouched and use it for TPTP Syntax side by side
> > >
> > > with DCG. On the other hand the DCG Draft wants an
> > > exception for the (;)/2 and reflect it into (|)/2, causing
> > > infinitely many nonsense problems.
> > >
> > > See also:
> > >
> > > % operator definitions (TPTP syntax)
> > >
> > > :- op( 500, fy, ~). % negation
> > > :- op(1000, xfy, &). % conjunction
> > > :- op(1100, xfy, '|'). % disjunction
> > > :- op(1110, xfy, =>). % implication
> > >
> > > https://www.philipzucker.com/javascript-automated-proving/

Re: About the Operator '|' and the DCG Draft

<103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1071&group=comp.lang.prolog#1071

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:100c:: with SMTP id z12mr4748357qkj.680.1641941748580;
Tue, 11 Jan 2022 14:55:48 -0800 (PST)
X-Received: by 2002:a25:3758:: with SMTP id e85mr4817843yba.618.1641941748325;
Tue, 11 Jan 2022 14:55:48 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 11 Jan 2022 14:55:48 -0800 (PST)
In-Reply-To: <1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 11 Jan 2022 22:55:48 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 38
 by: Mostowski Collapse - Tue, 11 Jan 2022 22:55 UTC

Here is a little educational parser called Birdy. Joseph Vidal-Rosset might
use it in his prover web site? It understands xfy and fy only, very primitiv.
Advantage, Birdy accepts lower and upper case as atom:

/* Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.1) */

?- parse('p=>(q=>p)', T), write_canonical(T), nl.
=>(p,=>(q,p))

?- parse('P=>(Q=>P)', T), write_canonical(T), nl.
=>('P',=>('Q','P'))

?- parse('p=>p|q=>(q=> ~ ~r&s)', T), write_canonical(T), nl.
=>(p,=>('|'(p,q),=>(q,&(~(~(r)),s))))

Thats the code of Birdy:

:- set_prolog_flag(double_quotes, codes).

oper(500, fy, ~).
oper(1000, xfy, &).
oper(1100, xfy, '|').
oper(1110, xfy, =>).

parse(A, T) :-
atom_codes(A, C),
tokens(L, C, []),
term(T, 1200, L, []).

term(X, L) --> factor(Y), rest(Y, L, X).

rest(Y, L, S) --> [atom(X)], {oper(M, xfy, X)}, {M =< L}, !,
term(Z, M), {T =.. [X,Y,Z]}, rest(T, L, S).
rest(Y, _, Y) --> [].

factor(X) --> [lpar], !, term(X, 1200), [rpar].
factor(Z) --> [atom(X)], {oper(L, fy, X)}, !,
term(Y, L), {Z =.. [X,Y]}.
factor(X) --> [atom(X)].

Re: About the Operator '|' and the DCG Draft

<628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1072&group=comp.lang.prolog#1072

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5ad0:: with SMTP id d16mr1993099qtd.557.1641941880293;
Tue, 11 Jan 2022 14:58:00 -0800 (PST)
X-Received: by 2002:a25:24c9:: with SMTP id k192mr8536768ybk.405.1641941880060;
Tue, 11 Jan 2022 14:58:00 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 11 Jan 2022 14:57:59 -0800 (PST)
In-Reply-To: <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Tue, 11 Jan 2022 22:58:00 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 72
 by: Mostowski Collapse - Tue, 11 Jan 2022 22:57 UTC

This belongs also to Birdy, the tokenizer:

tokens([X|L]) --> token(X), !, tokens(L).
tokens([]) --> [].

token(F) --> " ", !, token(F).
token(atom(A)) --> alpha(X), !, alphanums(L), {atom_codes(A, [X|L])}.
token(atom(A)) --> sym(X), !, syms(L), {atom_codes(A, [X|L])}.
token(lpar) --> "(", !.
token(rpar) --> ")".

alphanums([X|L]) --> alpha(X), !, alphanums(L).
alphanums([X|L]) --> num(X), !, alphanums(L).
alphanums([]) --> [].

alpha(X) --> [X], {0'a =< X, X =< 0'z}, !.
alpha(X) --> [X], {0'A =< X, X =< 0'Z}, !.
alpha(X) --> [X], {member(X, "_")}.

num(X) --> [X], {0'0 =< X, X =< 0'9}, !.

syms([X|L]) --> sym(X), !, syms(L).
syms([]) --> [].

sym(X) --> [X], {member(X, "<=>&|~")}.

Why do such a thing? Well it gets interesting, since we could now
add quantifier parsing, which is not available in ordinary Prolog. We
could also extend it by automatically for example mapping Unicode
→ into ASCII =>.

Mostowski Collapse schrieb am Dienstag, 11. Januar 2022 um 23:55:49 UTC+1:
> Here is a little educational parser called Birdy. Joseph Vidal-Rosset might
> use it in his prover web site? It understands xfy and fy only, very primitiv.
> Advantage, Birdy accepts lower and upper case as atom:
>
> /* Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.1) */
>
> ?- parse('p=>(q=>p)', T), write_canonical(T), nl.
> =>(p,=>(q,p))
>
> ?- parse('P=>(Q=>P)', T), write_canonical(T), nl.
> =>('P',=>('Q','P'))
>
> ?- parse('p=>p|q=>(q=> ~ ~r&s)', T), write_canonical(T), nl.
> =>(p,=>('|'(p,q),=>(q,&(~(~(r)),s))))
>
> Thats the code of Birdy:
>
> :- set_prolog_flag(double_quotes, codes).
>
> oper(500, fy, ~).
> oper(1000, xfy, &).
> oper(1100, xfy, '|').
> oper(1110, xfy, =>).
>
> parse(A, T) :-
> atom_codes(A, C),
> tokens(L, C, []),
> term(T, 1200, L, []).
>
> term(X, L) --> factor(Y), rest(Y, L, X).
>
> rest(Y, L, S) --> [atom(X)], {oper(M, xfy, X)}, {M =< L}, !,
> term(Z, M), {T =.. [X,Y,Z]}, rest(T, L, S).
> rest(Y, _, Y) --> [].
>
> factor(X) --> [lpar], !, term(X, 1200), [rpar].
> factor(Z) --> [atom(X)], {oper(L, fy, X)}, !,
> term(Y, L), {Z =.. [X,Y]}.
> factor(X) --> [atom(X)].

Re: About the Operator '|' and the DCG Draft

<01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1073&group=comp.lang.prolog#1073

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5ad0:: with SMTP id d16mr3536500qtd.557.1641988700954;
Wed, 12 Jan 2022 03:58:20 -0800 (PST)
X-Received: by 2002:a05:6902:703:: with SMTP id k3mr12294903ybt.225.1641988700760;
Wed, 12 Jan 2022 03:58:20 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 12 Jan 2022 03:58:20 -0800 (PST)
In-Reply-To: <628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
<628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 12 Jan 2022 11:58:20 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 92
 by: Mostowski Collapse - Wed, 12 Jan 2022 11:58 UTC

Ok I made a further version, which in summary adresses
two issues with the default Prolog parser:

- Upper Case: The new tokenizer should not classify upper
case tokens into Prolog variables, instead they should
simply go into Prolog atoms.

- Solo Characters: The new tokenizer should have a larger
class of solo character tokens, this is more comfortable
for prefix operators.

See also:

Prolog Operator Syntax in One Page
https://twitter.com/dogelogch/status/1481227386939183107

Prolog Operator Syntax in One Page
https://www.facebook.com/groups/dogelog

Mostowski Collapse schrieb am Dienstag, 11. Januar 2022 um 23:58:01 UTC+1:
> This belongs also to Birdy, the tokenizer:
>
> tokens([X|L]) --> token(X), !, tokens(L).
> tokens([]) --> [].
>
> token(F) --> " ", !, token(F).
> token(atom(A)) --> alpha(X), !, alphanums(L), {atom_codes(A, [X|L])}.
> token(atom(A)) --> sym(X), !, syms(L), {atom_codes(A, [X|L])}.
> token(lpar) --> "(", !.
> token(rpar) --> ")".
>
> alphanums([X|L]) --> alpha(X), !, alphanums(L).
> alphanums([X|L]) --> num(X), !, alphanums(L).
> alphanums([]) --> [].
>
> alpha(X) --> [X], {0'a =< X, X =< 0'z}, !.
> alpha(X) --> [X], {0'A =< X, X =< 0'Z}, !.
> alpha(X) --> [X], {member(X, "_")}.
>
> num(X) --> [X], {0'0 =< X, X =< 0'9}, !.
>
> syms([X|L]) --> sym(X), !, syms(L).
> syms([]) --> [].
>
> sym(X) --> [X], {member(X, "<=>&|~")}.
>
> Why do such a thing? Well it gets interesting, since we could now
> add quantifier parsing, which is not available in ordinary Prolog. We
> could also extend it by automatically for example mapping Unicode
> → into ASCII =>.
> Mostowski Collapse schrieb am Dienstag, 11. Januar 2022 um 23:55:49 UTC+1:
> > Here is a little educational parser called Birdy. Joseph Vidal-Rosset might
> > use it in his prover web site? It understands xfy and fy only, very primitiv.
> > Advantage, Birdy accepts lower and upper case as atom:
> >
> > /* Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.1) */
> >
> > ?- parse('p=>(q=>p)', T), write_canonical(T), nl.
> > =>(p,=>(q,p))
> >
> > ?- parse('P=>(Q=>P)', T), write_canonical(T), nl.
> > =>('P',=>('Q','P'))
> >
> > ?- parse('p=>p|q=>(q=> ~ ~r&s)', T), write_canonical(T), nl.
> > =>(p,=>('|'(p,q),=>(q,&(~(~(r)),s))))
> >
> > Thats the code of Birdy:
> >
> > :- set_prolog_flag(double_quotes, codes).
> >
> > oper(500, fy, ~).
> > oper(1000, xfy, &).
> > oper(1100, xfy, '|').
> > oper(1110, xfy, =>).
> >
> > parse(A, T) :-
> > atom_codes(A, C),
> > tokens(L, C, []),
> > term(T, 1200, L, []).
> >
> > term(X, L) --> factor(Y), rest(Y, L, X).
> >
> > rest(Y, L, S) --> [atom(X)], {oper(M, xfy, X)}, {M =< L}, !,
> > term(Z, M), {T =.. [X,Y,Z]}, rest(T, L, S).
> > rest(Y, _, Y) --> [].
> >
> > factor(X) --> [lpar], !, term(X, 1200), [rpar].
> > factor(Z) --> [atom(X)], {oper(L, fy, X)}, !,
> > term(Y, L), {Z =.. [X,Y]}.
> > factor(X) --> [atom(X)].

Re: About the Operator '|' and the DCG Draft

<9a00a367-a5dc-4980-9c54-eab6aab28d7en@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1074&group=comp.lang.prolog#1074

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:411:: with SMTP id n17mr7338074qtx.439.1641991518279;
Wed, 12 Jan 2022 04:45:18 -0800 (PST)
X-Received: by 2002:a05:6902:703:: with SMTP id k3mr12533331ybt.225.1641991518090;
Wed, 12 Jan 2022 04:45:18 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 12 Jan 2022 04:45:17 -0800 (PST)
In-Reply-To: <01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
<628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com> <01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9a00a367-a5dc-4980-9c54-eab6aab28d7en@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 12 Jan 2022 12:45:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 136
 by: Mostowski Collapse - Wed, 12 Jan 2022 12:45 UTC

BTW: I have already a prototype in the pipeline that can do
quantifiers. But unfortunately not yet in the TPTP syntax.
Also not in the TPTP syntax with my modification.

But its relatively easy to add quantifier syntax to such
a parser/unparser. For example I added, so the idea is
that a quantifier has novel associativity icon fzy:

oper(!, fzy, 500).
oper(?, fzy, 500).

The parser needs only this additional clause:

factor(T) --> [atom(X)], {oper(X, fzy, M)}, !,
term(Y, 0), term(Z, M), {T =.. [X,Y,Z]}.

The unparser needs only this additional clause:

show(T, L) --> {T =.. [X, Y, Z], oper(X, fzy, M)}, !,
needs(L, M, '('),
[X], show(Y, 0), [' '], show(Z, M),
needs(L, M, ')').

Eh voilà the following works:

?- parse('!x p=>?x p', X).
X = =>(!(x, p), ?(x, p)).

?- unparse(=>(!(x, p), ?(x, p)), X).
X = '!x p=>?x p'.

?- parse('!x(p=>q)=>!x p=>!x q', X).
X = =>(!(x, =>(p, q)), =>(!(x, p), !(x, q))).

?- unparse(=>(!(x, =>(p, q)), =>(!(x, p), !(x, q))), X).
X = '!x (p=>q)=>!x p=>!x q'.

They are on par with prefix operators, so I assume they are
solo characters, which I did arrange in the tokenizer, and I
can then omit spaces around them.

Mostowski Collapse schrieb am Mittwoch, 12. Januar 2022 um 12:58:21 UTC+1:
> Ok I made a further version, which in summary adresses
> two issues with the default Prolog parser:
>
> - Upper Case: The new tokenizer should not classify upper
> case tokens into Prolog variables, instead they should
> simply go into Prolog atoms.
>
> - Solo Characters: The new tokenizer should have a larger
> class of solo character tokens, this is more comfortable
> for prefix operators.
>
> See also:
>
> Prolog Operator Syntax in One Page
> https://twitter.com/dogelogch/status/1481227386939183107
>
> Prolog Operator Syntax in One Page
> https://www.facebook.com/groups/dogelog
> Mostowski Collapse schrieb am Dienstag, 11. Januar 2022 um 23:58:01 UTC+1:
> > This belongs also to Birdy, the tokenizer:
> >
> > tokens([X|L]) --> token(X), !, tokens(L).
> > tokens([]) --> [].
> >
> > token(F) --> " ", !, token(F).
> > token(atom(A)) --> alpha(X), !, alphanums(L), {atom_codes(A, [X|L])}.
> > token(atom(A)) --> sym(X), !, syms(L), {atom_codes(A, [X|L])}.
> > token(lpar) --> "(", !.
> > token(rpar) --> ")".
> >
> > alphanums([X|L]) --> alpha(X), !, alphanums(L).
> > alphanums([X|L]) --> num(X), !, alphanums(L).
> > alphanums([]) --> [].
> >
> > alpha(X) --> [X], {0'a =< X, X =< 0'z}, !.
> > alpha(X) --> [X], {0'A =< X, X =< 0'Z}, !.
> > alpha(X) --> [X], {member(X, "_")}.
> >
> > num(X) --> [X], {0'0 =< X, X =< 0'9}, !.
> >
> > syms([X|L]) --> sym(X), !, syms(L).
> > syms([]) --> [].
> >
> > sym(X) --> [X], {member(X, "<=>&|~")}.
> >
> > Why do such a thing? Well it gets interesting, since we could now
> > add quantifier parsing, which is not available in ordinary Prolog. We
> > could also extend it by automatically for example mapping Unicode
> > → into ASCII =>.
> > Mostowski Collapse schrieb am Dienstag, 11. Januar 2022 um 23:55:49 UTC+1:
> > > Here is a little educational parser called Birdy. Joseph Vidal-Rosset might
> > > use it in his prover web site? It understands xfy and fy only, very primitiv.
> > > Advantage, Birdy accepts lower and upper case as atom:
> > >
> > > /* Welcome to SWI-Prolog (threaded, 64 bits, version 8.5.1) */
> > >
> > > ?- parse('p=>(q=>p)', T), write_canonical(T), nl.
> > > =>(p,=>(q,p))
> > >
> > > ?- parse('P=>(Q=>P)', T), write_canonical(T), nl.
> > > =>('P',=>('Q','P'))
> > >
> > > ?- parse('p=>p|q=>(q=> ~ ~r&s)', T), write_canonical(T), nl.
> > > =>(p,=>('|'(p,q),=>(q,&(~(~(r)),s))))
> > >
> > > Thats the code of Birdy:
> > >
> > > :- set_prolog_flag(double_quotes, codes).
> > >
> > > oper(500, fy, ~).
> > > oper(1000, xfy, &).
> > > oper(1100, xfy, '|').
> > > oper(1110, xfy, =>).
> > >
> > > parse(A, T) :-
> > > atom_codes(A, C),
> > > tokens(L, C, []),
> > > term(T, 1200, L, []).
> > >
> > > term(X, L) --> factor(Y), rest(Y, L, X).
> > >
> > > rest(Y, L, S) --> [atom(X)], {oper(M, xfy, X)}, {M =< L}, !,
> > > term(Z, M), {T =.. [X,Y,Z]}, rest(T, L, S).
> > > rest(Y, _, Y) --> [].
> > >
> > > factor(X) --> [lpar], !, term(X, 1200), [rpar].
> > > factor(Z) --> [atom(X)], {oper(L, fy, X)}, !,
> > > term(Y, L), {Z =.. [X,Y]}.
> > > factor(X) --> [atom(X)].

Re: About the Operator '|' and the DCG Draft

<57e977f3-001e-43ab-bb6d-9be04e217103n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1075&group=comp.lang.prolog#1075

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:58c5:: with SMTP id u5mr727341qta.190.1642020468556;
Wed, 12 Jan 2022 12:47:48 -0800 (PST)
X-Received: by 2002:a25:7287:: with SMTP id n129mr1939114ybc.351.1642020467985;
Wed, 12 Jan 2022 12:47:47 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 12 Jan 2022 12:47:47 -0800 (PST)
In-Reply-To: <9a00a367-a5dc-4980-9c54-eab6aab28d7en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
<628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com> <01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>
<9a00a367-a5dc-4980-9c54-eab6aab28d7en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <57e977f3-001e-43ab-bb6d-9be04e217103n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 12 Jan 2022 20:47:48 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 15
 by: Mostowski Collapse - Wed, 12 Jan 2022 20:47 UTC

Ok, there is a first prototype integrating the one page
Prolog operator syntax code, with the MathJax renderer.
The idea is simple, add a column to the table oper/3:

oper(~, fy, 800, '\\neg ').
oper(&, xfy, 1000, ' \\land ').
oper('|', xfy, 1100, ' \\lor ').
oper(=>, xfy, 1200, ' \\implies ').

See also:

Latex Bliss from Prolog Operator Syntax
https://twitter.com/dogelogch/status/1481360427636375554

Latex Bliss from Prolog Operator Syntax
https://www.facebook.com/groups/dogelog

Re: About the Operator '|' and the DCG Draft

<8c978142-86c2-4040-9210-5b4188e47a61n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1077&group=comp.lang.prolog#1077

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:c85:: with SMTP id r5mr14088796qvr.90.1642335956795;
Sun, 16 Jan 2022 04:25:56 -0800 (PST)
X-Received: by 2002:a25:bc0e:: with SMTP id i14mr18861431ybh.670.1642335956568;
Sun, 16 Jan 2022 04:25:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sun, 16 Jan 2022 04:25:56 -0800 (PST)
In-Reply-To: <57e977f3-001e-43ab-bb6d-9be04e217103n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
<628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com> <01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>
<9a00a367-a5dc-4980-9c54-eab6aab28d7en@googlegroups.com> <57e977f3-001e-43ab-bb6d-9be04e217103n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8c978142-86c2-4040-9210-5b4188e47a61n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 16 Jan 2022 12:25:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 43
 by: Mostowski Collapse - Sun, 16 Jan 2022 12:25 UTC

Now having fun with an output switch, can do:

?- parse('∀x ∃y f(x) = y', F).
F = !(:([_0 = x], ?(:([_1 = y], f(_0) = _1)))).

?- unparse(!(:([A = x], ?(:([B = y], f(A) = B)))), unicode, T).
T = '∀x ∃y f(x) = y'.

?- unparse(!(:([A = x], ?(:([B = y], f(A) = B)))), latex, T).
T = '\\forall x\\, \\exists y\\, \\mathup{f}(x) = y'.

The LaTeX DCG result can be used inside a browser via MathJax.
But with the novel operator type fzy, that is used under the hood,
I am also solving another problem, not only LaTeX output.

The other problem that is also solved is dealing with input and output
of formulas that contain quantifiers. The library is now called
Formula Interlingua Library (FIL).

See also:

Formula Interlingua from Prolog Operator Syntax
https://twitter.com/dogelogch/status/1482536744872521732

Formula Interlingua from Prolog Operator Syntax
https://www.facebook.com/groups/dogelog

Mostowski Collapse schrieb am Mittwoch, 12. Januar 2022 um 21:47:49 UTC+1:
> Ok, there is a first prototype integrating the one page
> Prolog operator syntax code, with the MathJax renderer.
> The idea is simple, add a column to the table oper/3:
>
> oper(~, fy, 800, '\\neg ').
> oper(&, xfy, 1000, ' \\land ').
> oper('|', xfy, 1100, ' \\lor ').
> oper(=>, xfy, 1200, ' \\implies ').
>
> See also:
>
> Latex Bliss from Prolog Operator Syntax
> https://twitter.com/dogelogch/status/1481360427636375554
>
> Latex Bliss from Prolog Operator Syntax
> https://www.facebook.com/groups/dogelog

Re: About the Operator '|' and the DCG Draft

<37b8dc4b-60cc-4917-bcd8-1413006f4bd4n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1078&group=comp.lang.prolog#1078

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ad4:4ee6:: with SMTP id dv6mr14374934qvb.77.1642336212052;
Sun, 16 Jan 2022 04:30:12 -0800 (PST)
X-Received: by 2002:a25:c841:: with SMTP id y62mr23381049ybf.196.1642336211425;
Sun, 16 Jan 2022 04:30:11 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sun, 16 Jan 2022 04:30:11 -0800 (PST)
In-Reply-To: <8c978142-86c2-4040-9210-5b4188e47a61n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <103cc01e-89d9-4a2f-910c-1b8777095c1cn@googlegroups.com>
<628730a2-c81f-4e1a-ac01-0cb96797776bn@googlegroups.com> <01f705d7-1401-4aee-9d06-e26c2108ce9en@googlegroups.com>
<9a00a367-a5dc-4980-9c54-eab6aab28d7en@googlegroups.com> <57e977f3-001e-43ab-bb6d-9be04e217103n@googlegroups.com>
<8c978142-86c2-4040-9210-5b4188e47a61n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <37b8dc4b-60cc-4917-bcd8-1413006f4bd4n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 16 Jan 2022 12:30:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 78
 by: Mostowski Collapse - Sun, 16 Jan 2022 12:30 UTC

Adding MathJax to your web site is very simple,
bypassing the now outdated and not widely
supported MathML. MathJax notes the following

problems with MathML:

> CommonHTML and not MathML is MathJax’s primary output
> mode since MathJax version 2.6. Its major advantage is its
> quality, consistency, and the fact that its output is independent
> of the browser, operating system, and user environment.
> HTML Support — MathJax 3.2 documentation
> https://docs.mathjax.org/en/latest/output/html.html

This worked for me:

- Step 1: Load the MathJax library. Load the CommonHTML
output processor (chtml), that renders your mathematics
using HTML with CSS styling:

<script src="http://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"
id="MathJax-script" async=""> </script>

- Step 2: Make the MathJax library load some stuff by itself.
This is a little cludge, not sure what would be the official
approach here, this loads bussproof:

<p>\begin{prooftree} \end{prooftree}</p>

- Step 3: Notify MathJax library if you have DOM changes. Not
needed after browser page load, only for user interaction. Do
this JavaScript when you are finished doing updates:

MathJax.typeset();

Mostowski Collapse schrieb am Sonntag, 16. Januar 2022 um 13:25:57 UTC+1:
> Now having fun with an output switch, can do:
>
> ?- parse('∀x ∃y f(x) = y', F).
> F = !(:([_0 = x], ?(:([_1 = y], f(_0) = _1)))).
>
> ?- unparse(!(:([A = x], ?(:([B = y], f(A) = B)))), unicode, T).
> T = '∀x ∃y f(x) = y'.
>
> ?- unparse(!(:([A = x], ?(:([B = y], f(A) = B)))), latex, T).
> T = '\\forall x\\, \\exists y\\, \\mathup{f}(x) = y'.
>
> The LaTeX DCG result can be used inside a browser via MathJax.
> But with the novel operator type fzy, that is used under the hood,
> I am also solving another problem, not only LaTeX output.
>
> The other problem that is also solved is dealing with input and output
> of formulas that contain quantifiers. The library is now called
> Formula Interlingua Library (FIL).
>
> See also:
>
> Formula Interlingua from Prolog Operator Syntax
> https://twitter.com/dogelogch/status/1482536744872521732
>
> Formula Interlingua from Prolog Operator Syntax
> https://www.facebook.com/groups/dogelog
> Mostowski Collapse schrieb am Mittwoch, 12. Januar 2022 um 21:47:49 UTC+1:
> > Ok, there is a first prototype integrating the one page
> > Prolog operator syntax code, with the MathJax renderer.
> > The idea is simple, add a column to the table oper/3:
> >
> > oper(~, fy, 800, '\\neg ').
> > oper(&, xfy, 1000, ' \\land ').
> > oper('|', xfy, 1100, ' \\lor ').
> > oper(=>, xfy, 1200, ' \\implies ').
> >
> > See also:
> >
> > Latex Bliss from Prolog Operator Syntax
> > https://twitter.com/dogelogch/status/1481360427636375554
> >
> > Latex Bliss from Prolog Operator Syntax
> > https://www.facebook.com/groups/dogelog

Re: About the Operator '|' and the DCG Draft

<296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1080&group=comp.lang.prolog#1080

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a0c:f7ce:: with SMTP id f14mr20123204qvo.63.1642452680068;
Mon, 17 Jan 2022 12:51:20 -0800 (PST)
X-Received: by 2002:a25:9246:: with SMTP id e6mr13529663ybo.636.1642452679849;
Mon, 17 Jan 2022 12:51:19 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Mon, 17 Jan 2022 12:51:19 -0800 (PST)
In-Reply-To: <1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Mon, 17 Jan 2022 20:51:20 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 53
 by: Mostowski Collapse - Mon, 17 Jan 2022 20:51 UTC

Currently picking up the topic again. Seems I don't run
into problems when abandoning (|)/2 and favoring (;)/2 for DCG.

Its rather the rule to have (;)/2 and the exception
to have (|)/2. Take this example:

p --> q;r.
p --> q|r.

Just out of curriousity checked TauProlog, it barks
at the operator (|)/2, but does (;)/2:

error parsing program: error(syntax_error(. or operator
expected),[line(3),column(7),found(|)])
?- listing(p/2).
p(_1,_3) :- (q(_1,_2);r(_1,_3)),_2=_3.

And then checked SWI-Prolog. It does both operators:

?- listing(p/2).
p(A, B) :-
( q(A, B)
; r(A, B)
).
p(A, B) :-
( q(A, B)
; r(A, B)
).

So they both have (;)/2 as DCG disjunction.
Thats nice.

Mostowski Collapse schrieb am Montag, 10. Januar 2022 um 22:15:21 UTC+1:
> I dont know yet how much legacy will be destroyed by
> adopting (;)/2 and only (;)/2. If I remember well some
> Prolog system support both (|)/2 and (;)/2 in DCG?
>
> Not sure. And not sure what the experts say.
> Typically (|)/2 is rather rare, because for DCG there
> is not so much the idiom as seen in syntax docu:
>
> p --> "foo"
> | "bar"
> | "baz".
>
> Since we want to parse something, and return
> something. So although a syntax docu might read
> as in the above, practically this often turns into:
>
> p(ast1) --> "foo".
> p(ast2) --> "bar".
> p(ast3) --> "baz".
>
> The DCG disjunction disappears!

Re: About the Operator '|' and the DCG Draft

<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1138&group=comp.lang.prolog#1138

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:adf:f48c:0:b0:1ea:9cb7:6c8b with SMTP id l12-20020adff48c000000b001ea9cb76c8bmr2986656wro.60.1645575788808;
Tue, 22 Feb 2022 16:23:08 -0800 (PST)
X-Received: by 2002:a25:5906:0:b0:624:5abd:6216 with SMTP id
n6-20020a255906000000b006245abd6216mr18350980ybb.38.1645575788072; Tue, 22
Feb 2022 16:23:08 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.88.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 22 Feb 2022 16:23:07 -0800 (PST)
In-Reply-To: <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 00:23:08 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 23 Feb 2022 00:23 UTC

Some of the best kept secrets in Prolog. How to make a parser
that can parse TPTP Syntax? Here is the problem:

:- op( 600, fy, !).
prove(F, C, I) :- norm(F, C, G), iter(G, 0, C, I), !.

Hell breaks loose, and a naive Prolog parser wants me to write the
cut with parenthesis (!). But SWI-Prolog doesn't need that.

What is the magic potion that does this feat?

See also:
https://github.com/mthom/scryer-prolog/issues/1289

Re: About the Operator '|' and the DCG Draft

<b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1139&group=comp.lang.prolog#1139

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a5d:64ac:0:b0:1e7:1415:2548 with SMTP id m12-20020a5d64ac000000b001e714152548mr21767392wrp.267.1645575971005;
Tue, 22 Feb 2022 16:26:11 -0800 (PST)
X-Received: by 2002:a25:13c6:0:b0:61e:105e:d291 with SMTP id
189-20020a2513c6000000b0061e105ed291mr25599688ybt.104.1645575970487; Tue, 22
Feb 2022 16:26:10 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 22 Feb 2022 16:26:10 -0800 (PST)
In-Reply-To: <1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 00:26:11 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 23 Feb 2022 00:26 UTC

For example in formerly Jekejeke Prolog and in Dogelog I can
also parse the same. Because I do have additional rules to the
following operator escaping that is suggested:

(!)

I added these operator escapes, the ')' escaping is only a special
case of it, the general routine does the following:

% read_prefix(-Term, +Integer, +Integer, +Integer, +Quad, -Quad)
read_prefix(A, A, _, _, _) --> current_token(T), {is_stopper(T)}, !.
read_prefix(H, A, L, R, E) -->
{L < R -> throw(error(syntax_error(operator_clash), _)); true},
{T is R-E}, read(Z, T), {H =.. [A, Z]}.
% is_stopper(+Term)
is_stopper(',').
is_stopper('|').
is_stopper(')'). %%% Covers the usual ( op ) and more %%%%
is_stopper(']').
is_stopper('}').
is_stopper('.').

Its open source and 100% pure Prolog:
http://pages.xlog.ch/littab/doclet/docs/05_devel/transpiler/loader.html

Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 01:23:10 UTC+1:
> Some of the best kept secrets in Prolog. How to make a parser
> that can parse TPTP Syntax? Here is the problem:
>
> :- op( 600, fy, !).
> prove(F, C, I) :- norm(F, C, G), iter(G, 0, C, I), !.
>
> Hell breaks loose, and a naive Prolog parser wants me to write the
> cut with parenthesis (!). But SWI-Prolog doesn't need that.
>
> What is the magic potion that does this feat?
>
> See also:
> https://github.com/mthom/scryer-prolog/issues/1289

Re: About the Operator '|' and the DCG Draft

<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1140&group=comp.lang.prolog#1140

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6000:22f:b0:1e3:3415:4078 with SMTP id l15-20020a056000022f00b001e334154078mr21168821wrz.69.1645576226601;
Tue, 22 Feb 2022 16:30:26 -0800 (PST)
X-Received: by 2002:a81:4d41:0:b0:2d7:513a:f3d3 with SMTP id
a62-20020a814d41000000b002d7513af3d3mr11154101ywb.34.1645576226119; Tue, 22
Feb 2022 16:30:26 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 22 Feb 2022 16:30:25 -0800 (PST)
In-Reply-To: <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 00:30:26 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 23 Feb 2022 00:30 UTC

SWI-Prolog might have yet another heuristic, this is genuine
Dogelog player. But its a quite useful heuristic. Here you see
how the ',' stopper together with the ')' stopper does a little more.

I can for example parse the following in Dogelog player:

?- X = (-, -).
X = (-, -).
http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html

SWI-Prolog adds some parenthesis around - during writing, but
this is not necessary, when it can parse it without, why should it
write it with? Formerly Jekejeke Prolog and Dogelog cover this

case also during writing. On the other hand Scryer Prolog gives me:

?- X = (-, -).
caught: error(syntax_error(incomplete_reduction),read_term/3:1)

Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 01:26:12 UTC+1:
> For example in formerly Jekejeke Prolog and in Dogelog I can
> also parse the same. Because I do have additional rules to the
> following operator escaping that is suggested:
>
> (!)
>
> I added these operator escapes, the ')' escaping is only a special
> case of it, the general routine does the following:
>
> % read_prefix(-Term, +Integer, +Integer, +Integer, +Quad, -Quad)
> read_prefix(A, A, _, _, _) --> current_token(T), {is_stopper(T)}, !.
> read_prefix(H, A, L, R, E) -->
> {L < R -> throw(error(syntax_error(operator_clash), _)); true},
> {T is R-E}, read(Z, T), {H =.. [A, Z]}.
> % is_stopper(+Term)
> is_stopper(',').
> is_stopper('|').
> is_stopper(')'). %%% Covers the usual ( op ) and more %%%%
> is_stopper(']').
> is_stopper('}').
> is_stopper('.').
>
> Its open source and 100% pure Prolog:
> http://pages.xlog.ch/littab/doclet/docs/05_devel/transpiler/loader.html
> Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 01:23:10 UTC+1:
> > Some of the best kept secrets in Prolog. How to make a parser
> > that can parse TPTP Syntax? Here is the problem:
> >
> > :- op( 600, fy, !).
> > prove(F, C, I) :- norm(F, C, G), iter(G, 0, C, I), !.
> >
> > Hell breaks loose, and a naive Prolog parser wants me to write the
> > cut with parenthesis (!). But SWI-Prolog doesn't need that.
> >
> > What is the magic potion that does this feat?
> >
> > See also:
> > https://github.com/mthom/scryer-prolog/issues/1289

Re: About the Operator '|' and the DCG Draft

<c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1141&group=comp.lang.prolog#1141

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:adf:c3cc:0:b0:1ed:b641:6ee2 with SMTP id d12-20020adfc3cc000000b001edb6416ee2mr48785wrg.529.1645577439756;
Tue, 22 Feb 2022 16:50:39 -0800 (PST)
X-Received: by 2002:a25:1057:0:b0:61d:d318:a69a with SMTP id
84-20020a251057000000b0061dd318a69amr25172880ybq.499.1645577439248; Tue, 22
Feb 2022 16:50:39 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.88.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Tue, 22 Feb 2022 16:50:39 -0800 (PST)
In-Reply-To: <163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 00:50:39 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mostowski Collapse - Wed, 23 Feb 2022 00:50 UTC

In general I think its good that SWI-Prolog pioneers a little bit
more than what is usually considered Prolog syntax. The only
problem is that Prolog has no “Living Standard” project,

unlike for example HTML.
https://html.spec.whatwg.org/

Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 01:30:28 UTC+1:
> SWI-Prolog might have yet another heuristic, this is genuine
> Dogelog player. But its a quite useful heuristic. Here you see
> how the ',' stopper together with the ')' stopper does a little more.
>
> I can for example parse the following in Dogelog player:
>
> ?- X = (-, -).
> X = (-, -).
> http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html
>
> SWI-Prolog adds some parenthesis around - during writing, but
> this is not necessary, when it can parse it without, why should it
> write it with? Formerly Jekejeke Prolog and Dogelog cover this
>
> case also during writing. On the other hand Scryer Prolog gives me:
>
> ?- X = (-, -).
> caught: error(syntax_error(incomplete_reduction),read_term/3:1)
> Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 01:26:12 UTC+1:
> > For example in formerly Jekejeke Prolog and in Dogelog I can
> > also parse the same. Because I do have additional rules to the
> > following operator escaping that is suggested:
> >
> > (!)
> >
> > I added these operator escapes, the ')' escaping is only a special
> > case of it, the general routine does the following:
> >
> > % read_prefix(-Term, +Integer, +Integer, +Integer, +Quad, -Quad)
> > read_prefix(A, A, _, _, _) --> current_token(T), {is_stopper(T)}, !.
> > read_prefix(H, A, L, R, E) -->
> > {L < R -> throw(error(syntax_error(operator_clash), _)); true},
> > {T is R-E}, read(Z, T), {H =.. [A, Z]}.
> > % is_stopper(+Term)
> > is_stopper(',').
> > is_stopper('|').
> > is_stopper(')'). %%% Covers the usual ( op ) and more %%%%
> > is_stopper(']').
> > is_stopper('}').
> > is_stopper('.').
> >
> > Its open source and 100% pure Prolog:
> > http://pages.xlog.ch/littab/doclet/docs/05_devel/transpiler/loader.html
> > Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 01:23:10 UTC+1:
> > > Some of the best kept secrets in Prolog. How to make a parser
> > > that can parse TPTP Syntax? Here is the problem:
> > >
> > > :- op( 600, fy, !).
> > > prove(F, C, I) :- norm(F, C, G), iter(G, 0, C, I), !.
> > >
> > > Hell breaks loose, and a naive Prolog parser wants me to write the
> > > cut with parenthesis (!). But SWI-Prolog doesn't need that.
> > >
> > > What is the magic potion that does this feat?
> > >
> > > See also:
> > > https://github.com/mthom/scryer-prolog/issues/1289

Re: About the Operator '|' and the DCG Draft

<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1142&group=comp.lang.prolog#1142

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a5d:6251:0:b0:1ea:9412:fc8b with SMTP id m17-20020a5d6251000000b001ea9412fc8bmr5225769wrv.657.1645609686252;
Wed, 23 Feb 2022 01:48:06 -0800 (PST)
X-Received: by 2002:a25:13c6:0:b0:61e:105e:d291 with SMTP id
189-20020a2513c6000000b0061e105ed291mr26902722ybt.104.1645609685718; Wed, 23
Feb 2022 01:48:05 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 23 Feb 2022 01:48:05 -0800 (PST)
In-Reply-To: <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 09:48:06 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 23 Feb 2022 09:48 UTC

It is extremly trivial as the is_stopper/1 source code shows,
it can be verbalized as follows:

/**
* Dont use the grammar production prefix_op term, when term is
* anyway no term determined by looking at the current token.
*/
And when in doubt, you can just try it online:

?- X = (- - a), write_canonical(X), nl.
-(-(a))
X = - -a.
?- X = (- - -), write_canonical(X), nl.
-(-(-))
X = - - - .

http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html

Re: About the Operator '|' and the DCG Draft

<9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1143&group=comp.lang.prolog#1143

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a5d:5709:0:b0:1ea:95eb:9e09 with SMTP id a9-20020a5d5709000000b001ea95eb9e09mr5268450wrv.188.1645609797130;
Wed, 23 Feb 2022 01:49:57 -0800 (PST)
X-Received: by 2002:a0d:e2ce:0:b0:2d1:5eb2:833b with SMTP id
l197-20020a0de2ce000000b002d15eb2833bmr28681285ywe.234.1645609796587; Wed, 23
Feb 2022 01:49:56 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 23 Feb 2022 01:49:56 -0800 (PST)
In-Reply-To: <82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 09:49:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Mostowski Collapse - Wed, 23 Feb 2022 09:49 UTC

I have the impression many Prolog systems have it or had it, and maybe
it slipped the ISO core standard or the Ulrich Neumerkel test cases, otherwise
I cannot explain how mode declarations such as append(+, +, -)

were/are handled? The is_stopper/1 doesn't change when something is a
prefix operator, its a conservative extension concerning the accepted
sentences by the language grammar.

It only changes when something is not a prefix operator. It produces
less many errors, i.e. the cryptic incomplete_reduction error by Scryer
Prolog goes away. It does so in a very simple and efficient way, not

needing some extra look ahead or complicated algorithm.

Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 10:48:07 UTC+1:
> It is extremly trivial as the is_stopper/1 source code shows,
> it can be verbalized as follows:
>
> /**
> * Dont use the grammar production prefix_op term, when term is
> * anyway no term determined by looking at the current token.
> */
> And when in doubt, you can just try it online:
>
> ?- X = (- - a), write_canonical(X), nl.
> -(-(a))
> X = - -a.
> ?- X = (- - -), write_canonical(X), nl.
> -(-(-))
> X = - - - .
>
> http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html

Re: About the Operator '|' and the DCG Draft

<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1144&group=comp.lang.prolog#1144

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6000:1ac7:b0:1e8:b550:a596 with SMTP id i7-20020a0560001ac700b001e8b550a596mr22445422wry.584.1645612135108;
Wed, 23 Feb 2022 02:28:55 -0800 (PST)
X-Received: by 2002:a5b:dc8:0:b0:624:a898:dea6 with SMTP id
t8-20020a5b0dc8000000b00624a898dea6mr10345336ybr.600.1645612134516; Wed, 23
Feb 2022 02:28:54 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Wed, 23 Feb 2022 02:28:54 -0800 (PST)
In-Reply-To: <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Wed, 23 Feb 2022 10:28:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 54
 by: Mostowski Collapse - Wed, 23 Feb 2022 10:28 UTC

The main challenge for Dogelog player was only to write a tokenizer
that plays into the hands of the parser, so that is_stopper/1 works
as desired. Note that I also have is_stopper('|'). This is consistent with:

?- X = '|'.
X = '|'.

?- X = | .
error(syntax_error(cannot_start_term), _0)
http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html

So there is some special handling of ',' and '|' already in the
tokenizer. For example the bare | is tokenized as '|' whereas
the quoted '|' is tokenized as atom('|').

Conceptually the same happens now in Dogelog player
and formerly Jekejeke Prolog, although Jekejeke Prolog does it
in Java, whereas Dogelog player does it in Prolog itself,

since also the tokenizer is 100% Prolog. So you could lookup
this part as well and find it "specified" in Prolog. Or lookup
some other Prolog or non-Prolog implementation.

Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 10:49:58 UTC+1:
> I have the impression many Prolog systems have it or had it, and maybe
> it slipped the ISO core standard or the Ulrich Neumerkel test cases, otherwise
> I cannot explain how mode declarations such as append(+, +, -)
>
> were/are handled? The is_stopper/1 doesn't change when something is a
> prefix operator, its a conservative extension concerning the accepted
> sentences by the language grammar.
>
> It only changes when something is not a prefix operator. It produces
> less many errors, i.e. the cryptic incomplete_reduction error by Scryer
> Prolog goes away. It does so in a very simple and efficient way, not
>
> needing some extra look ahead or complicated algorithm.
> Mostowski Collapse schrieb am Mittwoch, 23. Februar 2022 um 10:48:07 UTC+1:
> > It is extremly trivial as the is_stopper/1 source code shows,
> > it can be verbalized as follows:
> >
> > /**
> > * Dont use the grammar production prefix_op term, when term is
> > * anyway no term determined by looking at the current token.
> > */
> > And when in doubt, you can just try it online:
> >
> > ?- X = (- - a), write_canonical(X), nl.
> > -(-(a))
> > X = - -a.
> > ?- X = (- - -), write_canonical(X), nl.
> > -(-(-))
> > X = - - - .
> >
> > http://www.xlog.ch/izytab/doclet/docs/18_live/10_reference/example01/package.html

Re: About the Operator '|' and the DCG Draft

<52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1181&group=comp.lang.prolog#1181

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a37:9746:0:b0:61f:ea7b:a488 with SMTP id z67-20020a379746000000b0061fea7ba488mr19291217qkd.618.1646322715387;
Thu, 03 Mar 2022 07:51:55 -0800 (PST)
X-Received: by 2002:a25:6612:0:b0:628:ab58:578b with SMTP id
a18-20020a256612000000b00628ab58578bmr6520204ybc.343.1646322715051; Thu, 03
Mar 2022 07:51:55 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Thu, 3 Mar 2022 07:51:54 -0800 (PST)
In-Reply-To: <0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Thu, 03 Mar 2022 15:51:55 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 20
 by: Mostowski Collapse - Thu, 3 Mar 2022 15:51 UTC

I got just new interest in the issue of a living standard.
I found more evidence that Prolog systems or Prolog
related languages implement something more elaborate

than what a certain interpretation of the ISO core standard
would gives. New use case, the Mercury language state
variables notation, which uses ! prefix:

main(!IO) :-
io.write_string("The 100th prime is ", !IO),
X = prime(100),
io.write_int(X, !IO),
io.nl(!IO).
https://www.mercurylang.org/information/doc-latest/mercury_ref/State-variables.html#State-variables

Bringing the above to Prolog, you will possibly get scolded by
the ISO core standard orthodoxy fighters. As soon as ! is a prefix,
according to the orthodoxy fighters, whos names I do not want to

mention, you have to write (!) in your ordinary code, for the ordinary cut.

Re: About the Operator '|' and the DCG Draft

<0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1187&group=comp.lang.prolog#1187

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:622a:242:b0:2de:2b62:7633 with SMTP id c2-20020a05622a024200b002de2b627633mr1451981qtx.657.1646446882081;
Fri, 04 Mar 2022 18:21:22 -0800 (PST)
X-Received: by 2002:a81:23ce:0:b0:2dc:b20:cc73 with SMTP id
j197-20020a8123ce000000b002dc0b20cc73mr1340619ywj.130.1646446881834; Fri, 04
Mar 2022 18:21:21 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 4 Mar 2022 18:21:21 -0800 (PST)
In-Reply-To: <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com> <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 05 Mar 2022 02:21:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 44
 by: Mostowski Collapse - Sat, 5 Mar 2022 02:21 UTC

So there is a new study object, SWI-Prolog parser/scanner
reverse engineered into partially pPEG and manual Prolog code.

https://github.com/ridgeworks/pPEGpl/tree/main/Examples/SWIP-grammar

It becomes now apparent why SWI-Prolog is quite some dialect.
A lot of Prolog coding! Cudos. Trying to understand the example.

Historical backround why I am asking. The old DEC-10 Prolog
manual had a DCG specification of the Prolog syntax, which can
be turned into a direct Prolog parser, unless maybe when the

dialect is too far away. And pPEG can be more directly realized by
using DCG (\+)/1 for the non consuming features of pPEG and
by using DCG (!)/0 for the commited choice features of pPEG,

making pPEG anyway a rip-off of DCG. So I would imagine
a transpiler from pPEG to DCG, a path that was not chosen,
possibly because more complex threaded state.

Mostowski Collapse schrieb am Donnerstag, 3. März 2022 um 16:51:56 UTC+1:
> I got just new interest in the issue of a living standard.
> I found more evidence that Prolog systems or Prolog
> related languages implement something more elaborate
>
> than what a certain interpretation of the ISO core standard
> would gives. New use case, the Mercury language state
> variables notation, which uses ! prefix:
>
> main(!IO) :-
> io.write_string("The 100th prime is ", !IO),
> X = prime(100),
> io.write_int(X, !IO),
> io.nl(!IO).
> https://www.mercurylang.org/information/doc-latest/mercury_ref/State-variables.html#State-variables
>
> Bringing the above to Prolog, you will possibly get scolded by
> the ISO core standard orthodoxy fighters. As soon as ! is a prefix,
> according to the orthodoxy fighters, whos names I do not want to
>
> mention, you have to write (!) in your ordinary code, for the ordinary cut.

Re: About the Operator '|' and the DCG Draft

<c7ee2838-d75c-4807-982a-fd3567d82374n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1188&group=comp.lang.prolog#1188

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ac8:5c43:0:b0:2de:4ac9:6c62 with SMTP id j3-20020ac85c43000000b002de4ac96c62mr1428202qtj.465.1646447008902;
Fri, 04 Mar 2022 18:23:28 -0800 (PST)
X-Received: by 2002:a25:6612:0:b0:628:ab58:578b with SMTP id
a18-20020a256612000000b00628ab58578bmr1158851ybc.343.1646447008697; Fri, 04
Mar 2022 18:23:28 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Fri, 4 Mar 2022 18:23:28 -0800 (PST)
In-Reply-To: <0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com> <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
<0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c7ee2838-d75c-4807-982a-fd3567d82374n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 05 Mar 2022 02:23:28 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 55
 by: Mostowski Collapse - Sat, 5 Mar 2022 02:23 UTC

But putting aside how pPEG was implement. It is not
fully used. The SWIPL example uses the formal grammar
only for tokenization? Or something between tokenization

and parsing. Then something interesting happens in a second
pass and a separate Prolog text, not anymore pPEG based, the
parsed expression is flattened and then rebuilt again only then

using operators priority. So pPEG was not chosen to parse
the SWIPL dialect itself directly?

Mostowski Collapse schrieb am Samstag, 5. März 2022 um 03:21:23 UTC+1:
> So there is a new study object, SWI-Prolog parser/scanner
> reverse engineered into partially pPEG and manual Prolog code.
>
> https://github.com/ridgeworks/pPEGpl/tree/main/Examples/SWIP-grammar
>
> It becomes now apparent why SWI-Prolog is quite some dialect.
> A lot of Prolog coding! Cudos. Trying to understand the example.
>
> Historical backround why I am asking. The old DEC-10 Prolog
> manual had a DCG specification of the Prolog syntax, which can
> be turned into a direct Prolog parser, unless maybe when the
>
> dialect is too far away. And pPEG can be more directly realized by
> using DCG (\+)/1 for the non consuming features of pPEG and
> by using DCG (!)/0 for the commited choice features of pPEG,
>
> making pPEG anyway a rip-off of DCG. So I would imagine
> a transpiler from pPEG to DCG, a path that was not chosen,
> possibly because more complex threaded state.
> Mostowski Collapse schrieb am Donnerstag, 3. März 2022 um 16:51:56 UTC+1:
> > I got just new interest in the issue of a living standard.
> > I found more evidence that Prolog systems or Prolog
> > related languages implement something more elaborate
> >
> > than what a certain interpretation of the ISO core standard
> > would gives. New use case, the Mercury language state
> > variables notation, which uses ! prefix:
> >
> > main(!IO) :-
> > io.write_string("The 100th prime is ", !IO),
> > X = prime(100),
> > io.write_int(X, !IO),
> > io.nl(!IO).
> > https://www.mercurylang.org/information/doc-latest/mercury_ref/State-variables.html#State-variables
> >
> > Bringing the above to Prolog, you will possibly get scolded by
> > the ISO core standard orthodoxy fighters. As soon as ! is a prefix,
> > according to the orthodoxy fighters, whos names I do not want to
> >
> > mention, you have to write (!) in your ordinary code, for the ordinary cut.

Re: About the Operator '|' and the DCG Draft

<a0dd0b5f-b459-48d3-842b-675f9712c902n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1189&group=comp.lang.prolog#1189

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:6214:262a:b0:435:6c53:88ca with SMTP id gv10-20020a056214262a00b004356c5388camr3656577qvb.4.1646516559882;
Sat, 05 Mar 2022 13:42:39 -0800 (PST)
X-Received: by 2002:a25:8146:0:b0:629:2cb0:88ad with SMTP id
j6-20020a258146000000b006292cb088admr1005535ybm.217.1646516559680; Sat, 05
Mar 2022 13:42:39 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sat, 5 Mar 2022 13:42:39 -0800 (PST)
In-Reply-To: <c7ee2838-d75c-4807-982a-fd3567d82374n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com> <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
<0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com> <c7ee2838-d75c-4807-982a-fd3567d82374n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a0dd0b5f-b459-48d3-842b-675f9712c902n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sat, 05 Mar 2022 21:42:39 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 13
 by: Mostowski Collapse - Sat, 5 Mar 2022 21:42 UTC

Such 100% Prolog tokenizers and parsers are quite interesting. One could
attempt a multi-Prolog that can read various dialects of Prolog systems.
But if you would do that, you would possibly choose some

framework and model all Prolog system dialects in this framework?
Become independent of the other Prolog systems and its other
plattform. On the other hand one could of course spawn the other

Prolog system, consut there and call some listing/1 or write_canonical/1
to get the Prolog text. Wasn’t Logtalk working on a package exchange.
A package could have a tag in which dialect it is implemented and

a multi-Prolog could act accordingly.

Re: About the Operator '|' and the DCG Draft

<7950d178-a688-4122-ab3a-c5105359632cn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1190&group=comp.lang.prolog#1190

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:a05:620a:4725:b0:67a:ee5a:c830 with SMTP id bs37-20020a05620a472500b0067aee5ac830mr3687548qkb.717.1646567356164;
Sun, 06 Mar 2022 03:49:16 -0800 (PST)
X-Received: by 2002:a25:e30a:0:b0:625:3d53:91b7 with SMTP id
z10-20020a25e30a000000b006253d5391b7mr4708493ybd.499.1646567355902; Sun, 06
Mar 2022 03:49:15 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sun, 6 Mar 2022 03:49:15 -0800 (PST)
In-Reply-To: <a0dd0b5f-b459-48d3-842b-675f9712c902n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com> <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
<0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com> <c7ee2838-d75c-4807-982a-fd3567d82374n@googlegroups.com>
<a0dd0b5f-b459-48d3-842b-675f9712c902n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7950d178-a688-4122-ab3a-c5105359632cn@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 06 Mar 2022 11:49:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 48
 by: Mostowski Collapse - Sun, 6 Mar 2022 11:49 UTC

Living standard Prolog systems could also solve the package
exchange problem. The packages would not have a dialect tag,
the Prolog system would be polyglott enough to understand

a more flexible Prolog syntax. For example SWI-Prolog allows me to do,
something that is often used in TPTP syntax:

/* SWI-Prolog (threaded, 64 bits, version 8.5.1) */
?- [user].
p(A :- B) :- q(A), r(B).
^D

In another Prolog system this is not accepted:

/* TauProlog 0.3.2 (beta) */

/* In Program Textarea */
p(A :- B) :- q(A), r(B).

/* Press Reconsult program */
error parsing program: error(syntax_error(, or ) expected),[line(2),column(4),found(:-)])

But from reading Rick Workman reverse engineering of
SWI-Prolog dialect, I have now indeed an idea how this happens.
I guess I could try an according modification for the Dogelog player,

so that Dogelog player would be another living standard Prolog system.
Currently Dogelog player is already polyglott in some other corners of
the Prolog syntax, but not yet in this corner.

Mostowski Collapse schrieb am Samstag, 5. März 2022 um 22:42:40 UTC+1:
> Such 100% Prolog tokenizers and parsers are quite interesting. One could
> attempt a multi-Prolog that can read various dialects of Prolog systems.
> But if you would do that, you would possibly choose some
>
> framework and model all Prolog system dialects in this framework?
> Become independent of the other Prolog systems and its other
> plattform. On the other hand one could of course spawn the other
>
> Prolog system, consut there and call some listing/1 or write_canonical/1
> to get the Prolog text. Wasn’t Logtalk working on a package exchange.
> A package could have a tag in which dialect it is implemented and
>
> a multi-Prolog could act accordingly.

Re: About the Operator '|' and the DCG Draft

<d8530517-401e-46ec-84f3-7f09c8dd70f5n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=1191&group=comp.lang.prolog#1191

  copy link   Newsgroups: comp.lang.prolog
X-Received: by 2002:ae9:efcf:0:b0:47e:15e1:2a34 with SMTP id d198-20020ae9efcf000000b0047e15e12a34mr3866974qkg.689.1646567873751;
Sun, 06 Mar 2022 03:57:53 -0800 (PST)
X-Received: by 2002:a25:c08e:0:b0:628:d6eb:c944 with SMTP id
c136-20020a25c08e000000b00628d6ebc944mr4621555ybf.594.1646567873421; Sun, 06
Mar 2022 03:57:53 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.prolog
Date: Sun, 6 Mar 2022 03:57:53 -0800 (PST)
In-Reply-To: <7950d178-a688-4122-ab3a-c5105359632cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=77.57.53.70; posting-account=UjEXBwoAAAAOk5fiB8WdHvZddFg9nJ9r
NNTP-Posting-Host: 77.57.53.70
References: <27a911c0-3a2f-4054-81e5-bad9d8320750n@googlegroups.com>
<6ed26ce6-eaca-44f4-8c47-ff065227259bn@googlegroups.com> <2f729e39-7a7c-4079-9b34-08e080c6b242n@googlegroups.com>
<1a2d52b2-52ae-41c8-ad97-07dd4d07c264n@googlegroups.com> <296a2193-cea2-4aa1-a6de-eee173404568n@googlegroups.com>
<1f6e60c8-e8b2-42b8-9ca8-d1688ab1da26n@googlegroups.com> <b73e5ef2-93d6-4d30-ab36-d5fcb45531b8n@googlegroups.com>
<163a9271-9d06-4fbc-8d3c-1903bd8733bdn@googlegroups.com> <c07fe58b-ca4d-44d1-a716-1790a2033be0n@googlegroups.com>
<82d76042-37a3-44ab-addc-3784060038ccn@googlegroups.com> <9f1d1d60-7c54-4c2d-a655-04b651565d0bn@googlegroups.com>
<0d15e64d-f537-4313-b637-cdd0f66a1761n@googlegroups.com> <52b84705-714c-4248-b85b-a643413b7ff3n@googlegroups.com>
<0152c446-3e8e-4e4f-807c-51e913f95708n@googlegroups.com> <c7ee2838-d75c-4807-982a-fd3567d82374n@googlegroups.com>
<a0dd0b5f-b459-48d3-842b-675f9712c902n@googlegroups.com> <7950d178-a688-4122-ab3a-c5105359632cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d8530517-401e-46ec-84f3-7f09c8dd70f5n@googlegroups.com>
Subject: Re: About the Operator '|' and the DCG Draft
From: bursejan@gmail.com (Mostowski Collapse)
Injection-Date: Sun, 06 Mar 2022 11:57:53 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 80
 by: Mostowski Collapse - Sun, 6 Mar 2022 11:57 UTC

But this syntax enhancement will possibly not come in
release 0.9.8, too much other stuff to do. Also if Rick Workmans
reverse engineering where end-to-end grammarly specified,

also using some grammar notation for the operator
building phase, it would be easier to asses from paper
reading allone whether some ideas work or not,

currently its not end-to-end gammarly specified, we find:

properties such as precedence and associativity are part of the
semantics and will be addressed in post-parsing semantic analysis.
https://github.com/ridgeworks/pPEGpl/tree/main/Examples/SWIP-grammar

But usually this is not called semantics. If your operator building
pass turns surface S op T into op(S,T) thats not really semantics,
although some communities might like to call it so.

Specifications that are more grammarly are:

DEC-10 Prolog Manual (1982 University of Edinburgh, Dept of Artificial Intelligence)
https://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/prolog/doc/intro/prolog.doc

Tau Prolog
http://tau-prolog.org/files/doc/grammar-specification.pdf

ISO Core Standard
Have to recheck how it casts the operator building...

Mostowski Collapse schrieb am Sonntag, 6. März 2022 um 12:49:17 UTC+1:
> Living standard Prolog systems could also solve the package
> exchange problem. The packages would not have a dialect tag,
> the Prolog system would be polyglott enough to understand
>
> a more flexible Prolog syntax. For example SWI-Prolog allows me to do,
> something that is often used in TPTP syntax:
>
> /* SWI-Prolog (threaded, 64 bits, version 8.5.1) */
> ?- [user].
> p(A :- B) :- q(A), r(B).
> ^D
>
> In another Prolog system this is not accepted:
>
> /* TauProlog 0.3.2 (beta) */
>
> /* In Program Textarea */
> p(A :- B) :- q(A), r(B).
>
> /* Press Reconsult program */
> error parsing program: error(syntax_error(, or ) expected),[line(2),column(4),found(:-)])
>
> But from reading Rick Workman reverse engineering of
> SWI-Prolog dialect, I have now indeed an idea how this happens.
> I guess I could try an according modification for the Dogelog player,
>
> so that Dogelog player would be another living standard Prolog system.
> Currently Dogelog player is already polyglott in some other corners of
> the Prolog syntax, but not yet in this corner.
> Mostowski Collapse schrieb am Samstag, 5. März 2022 um 22:42:40 UTC+1:
> > Such 100% Prolog tokenizers and parsers are quite interesting. One could
> > attempt a multi-Prolog that can read various dialects of Prolog systems..
> > But if you would do that, you would possibly choose some
> >
> > framework and model all Prolog system dialects in this framework?
> > Become independent of the other Prolog systems and its other
> > plattform. On the other hand one could of course spawn the other
> >
> > Prolog system, consut there and call some listing/1 or write_canonical/1
> > to get the Prolog text. Wasn’t Logtalk working on a package exchange.
> > A package could have a tag in which dialect it is implemented and
> >
> > a multi-Prolog could act accordingly.

Pages:123
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor