Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #14629

Scryer Prolog totally clueless how DCGs work

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Scryer Prolog totally clueless how DCGs work
Date 2025-07-09 11:33 +0200
Message-ID <104ld1i$1vsct$1@solani.org> (permalink)

Show all headers | View raw


Woa! This nonsense really made my day:

https://github.com/mthom/scryer-prolog/discussions/3004

It starts with, where somebody "tried" a declarative DCG
using constraint logic programming:

number_tail(0, 0) --> [].
number_tail(Number, DigitsCount) -->
   ("," | ""),
   digit(Digit),
   number_tail(Digits, RestDigitsCount),
   {
     DigitsCount #= RestDigitsCount + 1,
     Number #= Digit * 10 ^ RestDigitsCount + Digits
   }.

He then noticed that its not deterministic. And since
it is not deterministic, clause ordering changes the
result when onced via once/1.

LoL

If DCGs had a cut, one would any way do:

number_tail(Number, DigitsCount) -->
   ("," | ""),
   digit(Digit), !,
   number_tail(Digits, RestDigitsCount),
   {
     DigitsCount #= RestDigitsCount + 1,
     Number #= Digit * 10 ^ RestDigitsCount + Digits
   }.
number_tail(0, 0) --> [].

Push the determinancy into the DCG. Otherwise you have
an explosion of choice points, and a lot of things go
totally wrong.

But the new DCG standard has no cut (!)/2.

Back to comp.lang.prolog | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Scryer Prolog totally clueless how DCGs work Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:33 +0200
  Lets see what the "experts" say (Was: Scryer Prolog totally clueless how DCGs work) Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:36 +0200
    Payed Ass-Lickers all around (Was: Lets see what the "experts" say) Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:38 +0200
      Its all about the money, not about quality (Was: Payed Ass-Lickers all around) Mild Shock <janburse@fastmail.fm> - 2025-07-09 11:42 +0200
        A case of dumbification by committee membership? (Was: Its all about the money, not about quality) Mild Shock <janburse@fastmail.fm> - 2025-07-09 20:01 +0200
    The stack overflow user by the name false (Was: Lets see what the "experts" say) Mild Shock <janburse@fastmail.fm> - 2025-07-15 11:50 +0200
      The choice is a little arbitrary from one angle (Re: The stack overflow user by the name false) Mild Shock <janburse@fastmail.fm> - 2025-07-15 11:59 +0200
    Prolog PIP-0110: Its a Floating-Point Multiverse? [Stoic Grisu versus Rest of World] (Was: Lets see what the "experts" say) Mild Shock <janburse@fastmail.fm> - 2026-04-29 00:38 +0200
  Does Scryer Prolog have all tricks up its sleeves? [Occurs Check] (Was: Scryer Prolog totally clueless how DCGs work) Mild Shock <janburse@fastmail.fm> - 2025-08-04 19:47 +0200
    How hard is PIP-0110 to implement? (Was: Does Scryer Prolog have all tricks up its sleeves?) Mild Shock <janburse@fastmail.fm> - 2026-04-26 22:43 +0200
      What about the rubber band ~t (Was: How hard is PIP-0110 to implement?) Mild Shock <janburse@fastmail.fm> - 2026-04-27 10:50 +0200
        Addendum Bresenham yatter, yatter (Was: What about the rubber band ~t) Mild Shock <janburse@fastmail.fm> - 2026-04-27 16:03 +0200
          Testing NVIDIA A10G / XVM Engine v10.2.4 (Permion Federal AI) (Was: Addendum Bresenham yatter, yatter) Mild Shock <janburse@fastmail.fm> - 2026-04-29 02:12 +0200
            This could be a serious security vulnerability (Was: Testing NVIDIA A10G / XVM Engine v10.2.4) Mild Shock <janburse@fastmail.fm> - 2026-04-29 02:22 +0200
              Logtalk big time salami slicing [For "Whales" (ultra-high rollers)?] (Re: This could be a serious security vulnerability) Mild Shock <janburse@fastmail.fm> - 2026-04-29 11:21 +0200
      format/3 that does not have some Spaghetti logic (Was: How hard is PIP-0110 to implement?) Mild Shock <janburse@fastmail.fm> - 2026-04-30 17:49 +0200

csiph-web