• =?UTF-8?Q?The_Blunder:_=e2=80=9cconstraint_programming=e2=80=9d_com?= =?UTF-8?Q?panies_in_France_1984=e2=80=931996_=28Was:_Difference_between_W-G?= =?UTF-8?Q?rammars_and_DCG_Transform=29?=

    From Mild Shock@janburse@fastmail.fm to comp.lang.prolog on Mon Oct 13 09:34:46 2025
    From Newsgroup: comp.lang.prolog

    Hi,

    What makes the Prolog community probably so
    dumbed down, concerning parsing and language theory.
    Is possibly the blunder of focusing on

    rCLconstraint programmingrCY in the 80s and 90s.
    So the Gen-X and later generations has become
    clueless about parsing and language theory.

    Alain Colmerauer lists in his China talk:

    - PrologIA
    - ILOG
    - COSYTEC

    But maybe dumbos like Julio Di Egidio
    <julio@diegidio.name> are the exception? The
    problem roots deeper. Not only has the Prolog

    community become dumbed down, about to
    use DCGs in production, it also doesn't trust
    a single Prolog system to do it efficiently

    to have it used in production, like the realization
    of a Prolog system itself. Somehow methods and
    tools to realize efficient DCGs in Prolog are

    missing. Most DCG attempts that one sees succumb
    to some declarative nonsense, creating exponentially
    many spurious choice points, you find rarely

    somebody mastering the Art.

    Bye

    Mild Shock schrieb:
    Hi,

    I didn't unlock the Metamorphoses Paper yet,
    its still behind a paywall for me. But
    a Paper about W-Grammars is available.

    The Paper about W-Grammars is from
    Alain Colmerauers website again.
    While a W-Grammar rule of the form:

    X |-> Y

    Leads mathematically to a rewrite rule:

    V,X,W ==> V,Y,W

    A DCG Transform of the form:

    P,Y --> X,P

    Leads mathematically to a rewrite rule:

    V,*,X,W ==> V,Y,*,W

    Where * is a kind of replacement cursor.
    So in DCG Transform there is no comming back
    to match and replace a previous position again.

    Thats why in my NetFish Transducer, I need
    "cascading", basically repeatedly applying
    the DCG Transforms by iteration,

    until a kind of fixpoint is reached.

    Bye

    See also:

    W-Grammar, Chastellier & Colmerauer (1968) http://alain.colmerauer.free.fr/alcol/ArchivesPublications/Wgrammar/Wgrammar.pdf


    Mild Shock schrieb:
    Hi,

    I only rediscovered a little bit that DCG has
    also semi-context, and that when using non-terminals
    in semi-contexts, these act like what

    was Meta-Grammars in W-Grammar, 1967rCo1968.
    W-Grammars with Meta-Grammars were basically
    Semi-Thue systems, but one needs to pay attention,

    the todays DCG cannot directly implement them:

    -aFrom natural language processing to Prolog
    http://alain.colmerauer.free.fr/alcol/ArchivesTransparents/ChinaApril2011/NatLanguageProlog.pdf


    What later came was Q-System, 1968rCo1970, French,
    1971rCo1973, Prolog, 1973rCo1976 and Prolog II,
    1977rCo1982. An early shift to CLP(X) was dif/2

    which already appeared in Prolog II. That todays
    Prolog commmunity is clueless about the grammar
    and transform aspect is really sad.

    Bye

    Mild Shock schrieb:
    Hi,

    Only morons waste time with regex when they have Prolog!
    Its amazing, since Alain Colmerauer was already
    juggling with a kind of transducers:

    "We present some very general grammars in which
    each re-writing rule is of the type: replace such
    and such sequence of trees by such and such another
    sequence of trees."
    https://www.researchgate.net/publication/225124810

    Still the Prolog community is to stupid to
    transduce CR, CR LF and LF into LF. Thats quite a
    feat. BTW, this should do using DCG semi-contexts:

    replace, [0'\n] --> [0'\r, 0'\n], replace.
    replace, [0'\n] --> [0'\r], replace.
    replace, [0'\n] --> [0'\n], replace.
    replace, [X] --> [X], replace.
    replace --> [].

    Works on my side:

    ?- replace("foo\rbar\r\nbaz", _L), atom_codes(A, _L).
    A = 'foo\nbar\nbaz'

    Now optimize it to produce 0'\n as early as
    possible and use a state machine, so that you
    can implement it low level in your streams.

    Have Fun!

    Bye


    --- Synchronet 3.21a-Linux NewsLink 1.2