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


Groups > comp.lang.prolog > #14902

Metamorphosis Grammars by Alain Colmerauer (Was: What about the <NEWLINE> ?)

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Metamorphosis Grammars by Alain Colmerauer (Was: What about the <NEWLINE> ?)
Date 2025-10-12 00:35 +0200
Message-ID <10cem2m$t6j6$1@solani.org> (permalink)
References <10cbu31$6r9g$1@dont-email.me> <10cd4s8$s7hn$1@solani.org> <10cddrd$kip6$1@dont-email.me>

Show all headers | View raw


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

Julio Di Egidio schrieb:
> On 11/10/2025 10:35, Mild Shock wrote:
>> Hi,
>>
>>  > and now I am implementing a new Prolog
>>
>> Mind then gap, there might be a <NEWLINE> lurking!
>>
>> LoL
> 
> LOL indeed, as that's the level of the discussion.
> 
> I have the lexer mostly ready, just missing full Unicode support:
> design, implementation, and testing, but I need to improve on the
> testing, for which I am taking a detour and building a Regex
> analyser and string generator.
> 
> The implementation is in C#.Net, which I find great for prototyping,
> anyway what I mean is a *specification and reference implementation*,
> then anybody can rewrite it in Java or ANSI C or anything (I am being
> careful in the constructs I am using to make that seamless), and sell
> that if they like...
> 
> You are a good tester: I would gladly keep you in the loop if you
> are seriously interested.
> 
> -Julio
> 

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


Thread

ISO Prolog and yet another stinking pile of crap Julio Di Egidio <julio@diegidio.name> - 2025-10-10 23:33 +0200
  What about the <NEWLINE> ? (Was: ISO Prolog and yet another stinking pile of crap) Mild Shock <janburse@fastmail.fm> - 2025-10-11 10:35 +0200
    Re: What about the <NEWLINE> ? (Was: ISO Prolog and yet another stinking pile of crap) Julio Di Egidio <julio@diegidio.name> - 2025-10-11 13:08 +0200
      Metamorphosis Grammars by Alain Colmerauer (Was: What about the <NEWLINE> ?) Mild Shock <janburse@fastmail.fm> - 2025-10-12 00:35 +0200
        Compact DCG Transducer by Dogelog Player (Was: Metamorphosis Grammars by Alain Colmerauer) Mild Shock <janburse@fastmail.fm> - 2025-10-12 00:55 +0200
          Did Picat, Minizinc, etc.. dumb down Prolog? (Was: Compact DCG Transducer by Dogelog Player) Mild Shock <janburse@fastmail.fm> - 2025-10-12 01:06 +0200
        Re: Metamorphosis Grammars by Alain Colmerauer (Was: What about the <NEWLINE> ?) Julio Di Egidio <julio@diegidio.name> - 2025-10-12 01:28 +0200
          Solve the Bootstrapping Problem: Self Hosting Systems (Was: Metamorphosis Grammars by Alain Colmerauer) Mild Shock <janburse@fastmail.fm> - 2025-10-12 04:28 +0200
        From natural language processing to Prolog [Beijing, April 8, 2011] (Re: Metamorphosis Grammars by Alain Colmerauer (Was: What about the <NEWLINE> ?) Mild Shock <janburse@fastmail.fm> - 2025-10-13 09:11 +0200
        From natural language processing to Prolog [Beijing, April 8, 2011] (Re: Metamorphosis Grammars by Alain Colmerauer (Was: What about the <NEWLINE> ?) Mild Shock <janburse@fastmail.fm> - 2025-10-13 09:11 +0200
          Difference between W-Grammars and DCG Transform (Was: From natural language processing to Prolog [Beijing, April 8, 2011]) Mild Shock <janburse@fastmail.fm> - 2025-10-13 09:23 +0200
            The Blunder: “constraint programming” companies in France 1984–1996 (Was: Difference between W-Grammars and DCG Transform) Mild Shock <janburse@fastmail.fm> - 2025-10-13 09:34 +0200
  Gradual Refinement: AI Memo 39 (Was: ISO Prolog and yet another stinking pile of crap) Mild Shock <janburse@fastmail.fm> - 2025-10-12 05:00 +0200

csiph-web