Talk:Peyo

Perhaps you can have it also, in Peyo-C (and possibly others), if you write "smurf" if there is only one valid word that makes sense there, it will use that word, maybe? Like, if there is one function in the program you can write smurf { } and it is the main function, and for #include and #define and so on you can write #smurf instead (it is always unambiguous if #include is meant, but for other preprocessor directives you can just make it based on the previous one (or #define if no previous one)), in place of for you can write smurf because no other C command has that syntax; to return from a void function you can write smurf instead of return; you can have defaults for some things for in case no previous command is found; you can write smurf instead of case (I think this is always unambiguous); in case of a control structure smurf(x) { case 1: z; } you can assume smurf here means select; and there is a lot more! Below here is my change to the 99 bottles of beer. --Zzo38 11:55, 26 June 2010 (UTC)

Peyo-C - 99-bottles
smurf /* Only function in program, must be main function */ {        smurf   z; /* int is default type in C */ smurf  *b = "of beer"; /* initial value is char* type, therefore must be char rather than int */ smurf  *w = "on the wall"; smurf (smurf = 99; smurf > 1;){ /* syntax is for and z is the only numeric variable */ smurf("%d bottles %s %s, %d bottles %s.\n", smurf, b, w, z, b); /* printf is default smurf function call when these kind of parameters are used */ z--; smurf("Take one down and pass it around, %d bottle%s %s %s.\n\n", smurf, smurf > 1 ? "s" : "", b, w); }        smurf("1 bottle %s %s, 1 bottle %s.\n", b, w, b); smurf("Take one down and pass it around, no more bottles %s %s.\n\n", smurf, w); smurf("No more bottles %s %s, no more bottles %s.\n", b, w, b); smurf("Go to the shop and buy some more, 99 bottles %s %s.\n", smurf, w); }
 * 1) smurf 

I really like this! Peyo has been developed (as smurf) in the mid 90's, and to keep things easy the smurf keyword was dependend on the syntax parsed so far only. (Actually we only build a basic interpreter, which was very easy). So the smurf keyword for main was not an option: you would have to parse the complete syntax before you see main (in plain text) is missing. With the original idea any preprocessor could remove all smurfing, with your proposal this will be much more difficult. But ... who cares? ;-)

On your example, I fully agree: the include on the first line should be smurf. And main should be smurf too, as main is mandatory. In fact you can use main in plain text and use smurf for an other function. If it is called and not defined, it must be the smurf function. For the z definition, all smurfs can have an initial value. The smurf type should be int, so this is good. I disagree on the next line: smurf *b can be "unsigned char*" too. I like the for-smurf, very good! I disagree on the for-initializer. Why should it be an integer variable? In C you can assign integers to chars and pointers too. And the same with the first printf call. It can be scanf too. And it can be a call to smurf (main) too. Not very likely but possible.

Thanks for your contribution, I like it to think about Peyo after that many years!

OK, I may have made some mistakes, but it is a general idea. --Zzo38 04:48, 30 June 2010 (UTC)

So maybe write a Peyo-HTML?
<!SMURF smurf>  Peyo-HTML    smurf { smurf: 20smurf; }  Peyo-HTML Smurfastic HTML  A lots of smurfs in source code! Isn't it wonderfull?  With smurfastic links (and smurfastic buttons)