Re: Bart's Language

Liste des GroupesRevenir à cl c  
Sujet : Re: Bart's Language
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.lang.c
Date : 20. Mar 2025, 23:38:02
Autres entêtes
Organisation : To protect and to server
Message-ID : <vri5c8$26v8m$1@paganini.bofh.team>
References : 1 2 3 4 5
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
bart <bc@freeuk.com> wrote:
On 18/03/2025 15:10, Waldek Hebisch wrote:
bart <bc@freeuk.com> wrote:
On 18/03/2025 12:17, Waldek Hebisch wrote:
bart <bc@freeuk.com> wrote:
>
This is the document I produced:
>
https://github.com/sal55/langs/blob/master/MFeatures.md
>
A couple of more substantial demo programs are here:
https://github.com/sal55/langs/tree/master/MExamples
>
(The bignum.m file was ported - by hand - to the bignum.c version that I
posted recently.)
>
Looking at features, can you say if the program below works?
And if it works, what is retrun value of foo?  "Equvalent" can
be written in C, but in C you have to keep sane order.
>
>
There were some tweaks needed; it indicates some basic info missing from
my write-up! (For example, that the function call needs to be bar() not
bar; 'const' is only for compile-time expressions; and that C's 'const'
doesn't exist - it only briefly mentions an attempt at 'let'.)
>
The revised code is shown below, with what I assumed were your
intentions.
 
Well, my intentions beter correspond to the C version below:
 
int foo() {
     const int c = c1(10);
     const int b = c + c2(2);
     const int a = b+c3(c);
     bar();
     baz();
     return c;
}
 
 
In this case, just write it like that, and only adjust it for the
somewhat different syntax:
 
  func foo:int =
      let int c := c1(10)
      let int b := c + c2(2)
      let int a := b+c3(c)
      bar()
      baz()
      return c
  end

In your description you wrote that declarations can be written
"out of order" and compiler will rearrange them in correct
order.  That looked like great opportunity to write obfuscated
code.  As you explained, it works differently, but I think
already the fixed version of code I gave shows potential.
And the following seem to satisfy your restriction that
'const' is compile time constant and what happens is
puzzling to the reader (better than goto-s used to confuse
control flow):

func foo:int =
    const a = b + c
    let int cc := c1(a)
    const b = c + 2
    let int bb := c2(b) + cc
    const c = 10
    bb + c
end

--
                              Waldek Hebisch

Date Sujet#  Auteur
18 Mar 25 * Bart's Language51bart
18 Mar 25 `* Re: Bart's Language50Waldek Hebisch
18 Mar 25  `* Re: Bart's Language49bart
18 Mar 25   `* Re: Bart's Language48Waldek Hebisch
18 Mar 25    +* Re: Bart's Language40bart
18 Mar 25    i+* Re: Bart's Language32David Brown
18 Mar 25    ii`* int a = a (Was: Bart's Language)31Kenny McCormack
18 Mar 25    ii +* Re: int a = a (Was: Bart's Language)22Janis Papanagnou
18 Mar 25    ii i+- Re: int a = a (Was: Bart's Language)1Kaz Kylheku
19 Mar 25    ii i`* Re: int a = a (Was: Bart's Language)20David Brown
19 Mar 25    ii i +- Re: int a = a (Was: Bart's Language)1Kaz Kylheku
19 Mar 25    ii i +* Re: int a = a11Keith Thompson
20 Mar 25    ii i i+* Re: int a = a9Tim Rentsch
20 Mar 25    ii i ii`* Re: int a = a8Keith Thompson
20 Mar 25    ii i ii `* Re: int a = a7David Brown
20 Mar 25    ii i ii  `* Re: int a = a6Keith Thompson
21 Mar 25    ii i ii   `* Re: int a = a5David Brown
21 Mar 25    ii i ii    `* Re: int a = a4Keith Thompson
21 Mar 25    ii i ii     +- Re: int a = a1David Brown
22 Mar 25    ii i ii     `* Re: int a = a2Tim Rentsch
22 Mar 25    ii i ii      `- Re: int a = a1Keith Thompson
20 Mar 25    ii i i`- Re: int a = a1David Brown
19 Mar 25    ii i +* Re: int a = a (Was: Bart's Language)5Chris M. Thomasson
20 Mar 25    ii i i`* Re: int a = a (Was: Bart's Language)4David Brown
20 Mar 25    ii i i `* Re: int a = a (Was: Bart's Language)3bart
20 Mar 25    ii i i  `* Re: int a = a (Was: Bart's Language)2David Brown
20 Mar 25    ii i i   `- Re: int a = a (Was: Bart's Language)1wij
20 Mar 25    ii i `* Re: int a = a (Was: Bart's Language)2Tim Rentsch
20 Mar 25    ii i  `- Re: int a = a (Was: Bart's Language)1David Brown
18 Mar 25    ii +* Re: int a = a (Was: Bart's Language)3David Brown
18 Mar 25    ii i`* Re: int a = a (Was: Bart's Language)2Janis Papanagnou
19 Mar 25    ii i `- Re: int a = a (Was: Bart's Language)1David Brown
19 Mar 25    ii `* Re: int a = a (Was: Bart's Language)5Tim Rentsch
19 Mar 25    ii  +- Re: int a = a1Keith Thompson
19 Mar 25    ii  +- Re: int a = a (Was: Bart's Language)1David Brown
19 Mar 25    ii  `* Re: int a = a (Was: Bart's Language)2Rosario19
20 Mar 25    ii   `- Re: int a = a (Was: Bart's Language)1Tim Rentsch
20 Mar 25    i`* Re: Bart's Language7Waldek Hebisch
21 Mar 25    i `* Re: Bart's Language6Keith Thompson
22 Mar 25    i  `* Re: Bart's Language5Waldek Hebisch
22 Mar 25    i   `* Re: Bart's Language4James Kuyper
22 Mar 25    i    +* Re: Bart's Language2Waldek Hebisch
23 Mar 25    i    i`- Re: Bart's Language1James Kuyper
23 Mar 25    i    `- By definition... (Was: Bart's Language)1Kenny McCormack
18 Mar 25    `* Re: Bart's Language7bart
20 Mar 25     `* Re: Bart's Language6Waldek Hebisch
21 Mar 25      +* Re: Bart's Language4Kaz Kylheku
21 Mar 25      i`* Re: Bart's Language3bart
21 Mar 25      i `* Re: Bart's Language2Kaz Kylheku
22 Mar 25      i  `- Re: Bart's Language1Tim Rentsch
21 Mar 25      `- Re: Bart's Language1bart

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal