PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > Re: YAPL - Yet Another Programming Language
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Re: YAPL - Yet Another Programming Language

Réponse
 
LinkBack Outils de la discussion
Vieux 30/06/2008, 23h17   #1
Roberto Waltman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

<adem24@adem24adem24.org.invalid> wrote:

>... a new programming language is needed ...
>...
> 8) There are no reserved words.
>

Wonderful! What the world needs is one more language that allows you
to write:

"IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"

or something like that...
--
Roberto Waltman

[ Please reply to the group,
return address is invalid ]
  Réponse avec citation
Vieux 01/07/2008, 01h01   #2
Richard Heathfield
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

Roberto Waltman said:

> <adem24@adem24adem24.org.invalid> wrote:
>
>>... a new programming language is needed ...
>>...
>> 8) There are no reserved words.
>>

> Wonderful! What the world needs is one more language that allows you
> to write:
>
> "IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"
>
> or something like that...


Your wish is my command.

Here is the source code for a compiler for the BETTIE (Begin/Else/Then/er,
Then/If/End) language:

/* BETTIE Compiler

The BETTIE (Begin/Else/Then/er, Then/If/End) language
has five keywords: BEGIN, ELSE, THEN, IF, and END.

I'll let you figure out the semantics for yourself.

Richard Heathfield, 1 July 2008
*/


#include <stdio.h>
#include <string.h>

#define LW 16

int t(unsigned long int n)
{
static unsigned long l = 0;
char x[] = "Oh? Oh! Oh okay.";
l==0 || putchar(' ');
putchar(x[(n & 0xFF000000) >> 24]);
putchar(x[(n & 0xFF0000) >> 16]);
putchar(x[(n & 0xFF00) >> 8]);
putchar(x[n & 0xFF]);
++l==LW && putchar('\n');
l%=LW;
return 1;
}

int main(void)
{
char i[256] = {0};
int ms = 0;
while(1 == scanf("%255s", i))
{
if(strcmp(i, "ELSE") == 0)
{
ms = !ms;
}
else
{
if(strcmp(i, "BEGIN") == 0)
{
(ms && t(0xB0C0F) && t(0xB0C06)) ||
(t(0xB0C06) && t(0xB0C02));
}
else if(strcmp(i, "END") == 0)
{
(ms && t(0xB0C06) && t(0xB0C0F)) ||
(t(0xB0C02) && t(0xB0C06));
}
else if(strcmp(i, "THEN") == 0)
{
(ms && t(0xB0C0F) && t(0xB0C02)) ||
(t(0xB0C02) && t(0xB0C0F));
}
else if(strcmp(i, "IF") == 0)
{
(ms && t(0xB0C0F) && t(0xB0C0F)) ||
(t(0xB0C06) && t(0xB0C06));
}
else
{
fprintf(stderr, "Syntax error: %s\n", i);
}
}
}
putchar('\n');
return 0;
}

And here is a "hello world" program written in BETTIE:

ELSE THEN IF IF IF IF IF IF IF IF IF ELSE BEGIN THEN ELSE IF
IF IF IF IF IF IF IF THEN ELSE IF END THEN ELSE END THEN IF IF
IF IF IF IF IF ELSE BEGIN THEN ELSE IF IF IF IF THEN ELSE IF
END THEN ELSE IF END IF IF IF IF IF IF IF END END IF IF IF END
THEN THEN THEN IF IF IF IF IF IF IF IF ELSE BEGIN THEN ELSE IF
IF IF IF THEN ELSE IF END THEN ELSE END THEN THEN THEN IF IF
IF IF IF IF IF IF IF IF ELSE BEGIN THEN ELSE IF IF IF IF IF IF
IF IF IF THEN ELSE IF END THEN IF IF IF ELSE END ELSE THEN THEN
THEN THEN ELSE END IF IF IF END ELSE IF IF IF IF IF IF ELSE END
ELSE IF IF IF IF IF IF IF IF ELSE END THEN THEN IF END

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
  Réponse avec citation
Vieux 01/07/2008, 10h02   #3
thomas.mertes@gmx.at
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

On 1 Jul., 00:17, Roberto Waltman <use...@rwaltman.com> wrote:
> <ade...@adem24adem24.org.invalid> wrote:
> >... a new programming language is needed ...
> >...
> > 8) There are no reserved words.

>
> Wonderful! What the world needs is one more language that allows you
> to write:
>
> "IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"
>
> or something like that...

Sorry, but Seed7 (the list is an almost exact copy from the Seed7
manual) does not support this. The keyword 'if' is not reserved in
the classic sense, but the syntax defined for 'if' requests that an
expression follows it. Since variables are not written this way, it
is not possible to define a variable named 'if'.

It can be subsumed that Seed7 reaches the goal of avoiding the
misuse of keywords in other ways and not by reserving them
altogether.

If you look at classic compilers (e.g. a Pascal compiler) there is a
distinction between reserved words and identifiers. Pascal compilers
and probably also Ada, C/C++, Java and C# compilers use an
enumeration type to represent the reserved words.

Since Seed7 allows user defined statements (which may introduce new
keywords) it is not possible to hardcode reserved words in the
compiler as it is done in Pascal, Ada, C/C++, Java and many other
compilers.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
  Réponse avec citation
Vieux 01/07/2008, 10h31   #4
Richard Heathfield
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

thomas.mertes@gmx.at said:

> On 1 Jul., 00:17, Roberto Waltman <use...@rwaltman.com> wrote:
>> <ade...@adem24adem24.org.invalid> wrote:
>> >... a new programming language is needed ...
>> >...
>> > 8) There are no reserved words.

>>
>> Wonderful! What the world needs is one more language that allows you
>> to write:
>>
>> "IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"
>>
>> or something like that...

> Sorry, but Seed7 (the list is an almost exact copy from the Seed7
> manual) does not support this.


BETTIE does.

See elsethread (or http://www.cpax.org.uk/prg/portable/bettie/ if you
prefer) for details.

Since BETTIE does support it and Seed7 doesn't, we must conclude that
BETTIE is the more powerful language (bless her).

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
  Réponse avec citation
Vieux 01/07/2008, 11h10   #5
thomas.mertes@gmx.at
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

On 1 Jul., 11:31, Richard Heathfield <r...@see.sig.invalid> wrote:
> thomas.mer...@gmx.at said:
>
> > On 1 Jul., 00:17, Roberto Waltman <use...@rwaltman.com> wrote:
> >> <ade...@adem24adem24.org.invalid> wrote:
> >> >... a new programming language is needed ...
> >> >...
> >> > 8) There are no reserved words.

>
> >> Wonderful! What the world needs is one more language that allows you
> >> to write:

>
> >> "IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE IF;"

>
> >> or something like that...

> > Sorry, but Seed7 (the list is an almost exact copy from the Seed7
> > manual) does not support this.

>
> BETTIE does.

I am sure that the world needs another esotheric programming
language. :-)

> Since BETTIE does support it and Seed7 doesn't, we must conclude that
> BETTIE is the more powerful language (bless her).

You obviously don't understand the Force ...

Look at the Seed7 homepage, it will introduce you to the Force.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
  Réponse avec citation
Vieux 01/07/2008, 12h38   #6
Richard Heathfield
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

thomas.mertes@gmx.at said:

> On 1 Jul., 11:31, Richard Heathfield <r...@see.sig.invalid> wrote:
>> thomas.mer...@gmx.at said:
>>
>> > On 1 Jul., 00:17, Roberto Waltman <use...@rwaltman.com> wrote:
>> >> <ade...@adem24adem24.org.invalid> wrote:
>> >> >... a new programming language is needed ...
>> >> >...
>> >> > 8) There are no reserved words.

>>
>> >> Wonderful! What the world needs is one more language that allows you
>> >> to write:

>>
>> >> "IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE
>> >> IF;"

>>
>> >> or something like that...
>> > Sorry, but Seed7 (the list is an almost exact copy from the Seed7
>> > manual) does not support this.

>>
>> BETTIE does.

>
> I am sure that the world needs another esotheric programming
> language. :-)


That's correct. In fact, you are now the second person to say so - and as
the Bellman nearly said, "What comp.lang.c tells you three times is true."
So all I need do is say:

The world is in desperate need of another Turing-complete but stupid
programming language!

Ladies and gentlemen, I give you - BETTIE!

http://www.cpax.org.uk/prg/portable/bettie/

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
  Réponse avec citation
Vieux 01/07/2008, 14h47   #7
thomas.mertes@gmx.at
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

On 1 Jul., 13:38, Richard Heathfield <r...@see.sig.invalid> wrote:
> thomas.mer...@gmx.at said:
>
> > On 1 Jul., 11:31, Richard Heathfield <r...@see.sig.invalid> wrote:
> >> thomas.mer...@gmx.at said:

>
> >> > On 1 Jul., 00:17, Roberto Waltman <use...@rwaltman.com> wrote:
> >> >> <ade...@adem24adem24.org.invalid> wrote:
> >> >> >... a new programming language is needed ...
> >> >> >...
> >> >> > 8) There are no reserved words.

>
> >> >> Wonderful! What the world needs is one more language that allows you
> >> >> to write:

>
> >> >> "IF IF THEN THEN ELSE IF ELSE THEN IF ELSE IF END THEN BEGIN ELSE
> >> >> IF;"

>
> >> >> or something like that...
> >> > Sorry, but Seed7 (the list is an almost exact copy from the Seed7
> >> > manual) does not support this.

>
> >> BETTIE does.

>
> > I am sure that the world needs another esotheric programming
> > language. :-)

>
> That's correct. In fact, you are now the second person to say so - and as
> the Bellman nearly said, "What comp.lang.c tells you three times is true."
> So all I need do is say:
>
> The world is in desperate need of another Turing-complete but stupid
> programming language!

There are never enough programming languages. :-) I got your irony,
but I would like to discuss the reserved word vs. keyword issue (and
other issues).

As I said already elsthread, the misuse of keywords is prohibited in
Seed7. Just because the compilers of most programming languages use
a table of hardcoded reserved words does not imply that this is the
only solution.

I know that new concepts start in a hostile world, but objective
professional feedback is the preferred reaction to them.

I hope that the new ways that I take in some areas do not discourage
you to think about them. I would be glad if you answer with a
professional view towards my ideas. Besids the points mentioned by
the OP the FAQ (see: http://seed7.sourceforge.net/faq.htm ) is a
good starting point for a professional response.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
  Réponse avec citation
Vieux 03/07/2008, 09h05   #8
thomas.mertes@gmx.at
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: YAPL - Yet Another Programming Language

On 1 Jul., 19:02, Richard Heathfield <r...@see.sig.invalid> wrote:
> thomas.mer...@gmx.at said:
>
> > [...] Just because the compilers of most programming languages use
> > a table of hardcoded reserved words does not imply that this is the
> > only solution.

>
> True enough. My own preferred solution is to divide the world into two
> namespaces. User namespace begins with an alphabetic character, and *no*
> language feature may interfere with that - i.e. no keywords or library
> routines may begin with an alphabetic letter.

Algol had something like that (although implementation dependend).
Every keyword had to be quoted or should start with a dot.

> Alas, some languages don't
> even follow /their own/ namespace schemes, let alone mine. (For example, C
> introduced the restrict keyword in C99. User space? Ha! Stomp stomp
> stomp...)

My solution to this is: Every program must request the language
version it is written in. Currently C would have 3 versions: K&R,
C89 and C99. Compilers should take this into account and old
programs could be used without change. Seed7 is better suited for
this feature than C, since all it's statements are defined in the
include file "seed7_05.s7i". Therefore another include file could
define a different language.

> > I know that new concepts start in a hostile world, but objective
> > professional feedback is the preferred reaction to them.

>
> Oh, I know. I just found it quite amusing that, within a hundred or so
> minutes of its being requested, I was able not only to design a language
> that met the specification, but also implement a (portable!) compiler for
> it and provide a sample program written in that language. (Within those
> hundred minutes I also devised a *de*compiler, which I didn't bother to
> publish.) I'm not sure whether anyone has actually got the whole joke
> yet...

Actually I got your joke quickly. I just did not want to talk about
esoteric languages like Ook!

> Anyway, FWIW, creativity is what counts. Keep coming up with new ideas, and
> eventually some of them *might* get through the thick skulls of the CS
> community.

It is not my intention to drill holes in thick skulls.
I see it more as an offer:

Seed7 is open source and it is an
extensible programming language.

Everybody can insert his ideas by using the extensibility
mechanisms or by changing the source. That means that
even the outdated concepts discussed in this thread
could be inserted. It is just not my intention to do so.

Greetings Thomas Mertes

Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h32.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,27385 seconds with 16 queries