Talk:Peyo

From Esolang
Jump to navigation Jump to search

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 <stdio.h>

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);
}


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! --(this comment by 77.61.181.218 at 12:57, 29 June 2010 UTC; please sign your comments with ~~~~)

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>
 <smurf smurf="smurf"><smurf>
 	<smurf smurf="utf-8">
 	<smurf>Peyo-HTML</smurf>
 	<smurf smurf="smurf/smurf" smurf="smurf" href="smurf.css">
 	<smurf smurf="smurf/smurf" src="smurf.js"></smurf>
 	<smurf smurf="smurf/smurf">
 
 smurf {
 	smurf: 20smurf;
 }
 	</smurf>
 </smurf><smurf onsmurf="smurf()">
 	<h1>Peyo-HTML</smurf>
 	<p>Smurfastic HTML</smurf>
 	<ul>
 		<smurf>A lots of smurfs in source code!
 		<smurf>Isn't it wonderfull?
 	</ul>
 	<smurf>With <smurf smurf="#">smurfastic links</smurf></smurf>
 	<smurf method="smurf">
 		<smurf onsmurf="smurf()">(and smurfastic buttons)</smurf>
 	</smurf>
 </smurf></smurf>

--(this comment by 83.20.115.164 at 20:04, 20 September 2012‎ UTC; please sign your comments with ~~~~)