WY-Anglis
WY-Anglis is designed by PSTF, is the Englishized version of wenyan.
Code Sample
All the commands are equivalent to Wenyan, and now I don't want to write them. If you can program in Wenyan and LOLCODE, you can also program in WY-Anglis.
Hello, world!
I have a string. It is *"Hello, world!"*. Output it.
99 bottles of beers
I have a number. It is 99. Its name is *a*.
Do this forever. If *a* is equals to 0 then stop it.
I have 7 strings. They are *a*, *"bottle(s) of beer on the wall, "*, *a*, *"bottle(s) of beer. \n"*,
*"Take one down and pass it around"*, *a - 1*, *"bottle(s) of beer on the wall, "*. Output them.
Subtract *a* by 1. *a* is the most recent result.
That's all.
I have a string. It is *"No more bottles of beer on the wall, no more bottles of beer. \nGo to the store and buy some more, 99 bottles of beer on the wall."*
Collatz conjecture
I have a magic. Its name is *Collatz*.
To perform this magic, I first need to get a number. Its name is *x*.
This is how I perform this magic:
I have a magic. Its name is *Helper*. To perform this magic, I first need to get a number. Its name is *y*.
This is how I perform this magic:
I have a number. Its name is *k*.
Divide *y* by 2. Get its remainder. Its name is *r*.
If *r* is not equal to 0 then:
Multiply *y* by 3. Add the most recent result by 1. *k* is the most recent result.
Otherwise then:
Divide *y* by 2. *k* is the most recent result.
That's all.
Return *k*.
That is how I perform the magic.
I have an array. Its name is *l*. Fill *l* with *x*.
Do this forever. If *x* is equals to 0 then stop it.
Perform *Helper* on *x*. *x* is the most recent result.
Fill *l* with *x*.
That's all.
Fill *l* with 1. Return *l*.
That is how I perform the magic.
Perform *Collatz* on 12. Output it.
Perform *Collatz* on 19. Output it.
Perform *Collatz* on 27. Output it.
Mandelbrot Set
I have a magic. Its name is *Mandelbrot*. To perform this magic, I first need to get 2 numbers. Their names are *width*, *height*. This is how I perform this magic: # Mandelbrolt Set is a famous fractal in the complex plane, which we can get with z^2 + c where z, c ∈ C. I have a string. It is "·█▓░╋@#$%+=- ". Its name is *Pixel Art*. # Present an image using various characters. Subtract 0 by 1. Its name is *top*. Add 0 by 1. Its name is *bottom*. Subtract 0 by 2. Its name is *left*. Add 0 by 2. Its name is *right*. Subtract *right* by *left*. Divide the most recent result by *width*. Its name is *Horstep*. Subtract *bottom* by *top*. Divide the most recent result by *height*. Its name is *Verstep*. I have a number. It is 0. Its name is *k*. Do this forever. If *k* is equals to *height* then stop it. Multiply *Verstep* by *k*. Add the most recent result by *top*. Its name is *i*. I have a string. Its name is *line*. I have a number. It is 0. Its name is *k2*. Do this forever. If *k2* is equals to *width* then stop it. Multiply *Horstep* by *k*. Add the most recent result by *left*. Its name is *x*. Get *i*. Its name is *ii*. Get *x*. Its name is *jj*. # For each pixel, calculate the largest iteration number to let it fall into cycle. I have a number. It is 0. Its name is *l*. Do this forever. If *l* is equals to 12 then stop it. Multiply *jj* by *jj*. Multiply *ii* by *ii*. Their names are *a*, *b*. Plus *a* with *b*. Its name is *c*. If *c* is equals to 4 then stop it. Multiple *ii* by *jj*. Multiply the most recent result by 2. Add the most recent result by *i*. *ii* is the most recent result. Subtract *a* by *b*. Add the most recent result by *x*. *jj* is the most recent result. Add 1 by *l*. *l* is the most recent result. That's all. # Now we have obtained their iteration numbers, and then we plot it using our character set. Subtract 13 by *l*. Its name is *l2*. Get *l2*th item from *Pixel Art*. Its name is *char*. Append *line* by *char*. *line* is the most recent result. Add 1 by *k2*. *k2* is the most recent result. That's all. I have a string. It is *line*. Output it. Add 1 by *k*. *k* is the most recent result. That's all. That is how I perform the magic. # Now we know how to draw the Mandelbrot set. Let's give it a try! Perform *Mandelbrot* on 59, 24.
Output in Consolas.
Example to Error Handling
I want to do this:
OUCH! I ran into a huge problem with *"FatalError"*.
If I failed to do that:
If the problem *"ReferenceError"* happened to me then:
I have a string. It is *"I have never seen that thing before."*. Output it.
If the problem *"SyntaxError"* happened to me then:
I have a string. It is *"I can't understand what exactly you are trying to say."*. Output it.
If the problem *"TypeError"* happened to me then:
I have a string. It is *"They are not the same thing."*. Output it.
If the problem *"FatalError"* happened to me then:
I have a string. It is *"Dies irae! Dies illa! Solvet saeclum in favilla, Teste David cum Sibylla!"*. Output it.
If the unknown problem happened to me then:
I have a string. It is *"?̨̥͖̪̙͍̞̉͒̾̓̈̌̍͆́͜?̺̦̟͍̖̫̮̖͛̒̓̐̄̿̇̄?̢̨̡̛͎̯̑͌̎̃̉͐͝ͅ?̢̪̭̫̝̠̤̆̋̂̔̍͐̽̔͒?̫͔̫͙͒̌̌̆̂̐̈́͟?̸͙̱͍͖͖̽̾̀͛͐?̸̧͓͔͚̩̎́̄̐̔̏̚?̢̟̫͎͚͕̙̎͌̉̇͑͋̍̑̐͒ͅͅ?̴̢̡̢̱͈͍̗̬̈̿͑̿̐̓͋͒̚͝ͅ?̞̠͖̦̜̩̳̂́̂̀̃͌"*. Output it.
Anyway I don't care.
I want to do this:
OUCH! I ran into a huge problem with *"NonImportantError"*.
If I failed to do that: Anyway I don't care.
Cheating Quine*
I have a string. It is the source code. Output it. # Only avaliable in WY-Anglis.
Import Sample
Once, I read the book «Mathematics». It wasn't until now that I learned how to perform the magic of *Absolute value*. Perform *Absolute value* on -114514. Output it.
Parrot
Once, I read the book «STDIN».
It wasn't until now that I learned how to perform the magic of *Read line*.
Do it forever.
Read 1 line. Its name is *h*.
If *h* is equal to *""* then: Stop. That's all.
I have a string. It is *h*. Output it.
That's all.
Computational Class
Because this programming language is directly derived from Wenyan, it has the same computational capabilities as Wenyan.
About Syntax
Every command must be written in strict English grammar. If your command violates English grammar (for example, forgetting to capitalize the first letter or confusing singular and plural forms), it will trigger a fatal error. If it only violates the syntax of the programming language, it will only trigger a syntax error.
OOP Program
Now we want to generate a rectangle.
I have a specie. Its name is *Rectangle*.
# Define an attribution for the class
*Rectangle* has 2 numbers. Their names are *a*, *b*.
# Define a method for the class
*Rectangle* has a magic. Its name is *Get area*.
To perform this magic, *Rectangle* first needs to get 2 numbers. Their names are *a*, *b*.
This is how *Rectangle* performs this magic:
Multiply *a* by *b*. Its name is *S*. Return *S*.
That is how *Rectangle* performs the magic.
I have a Rectangle. Its name is *rect_1*. Its *a* is 5. Its *b* is 4.
Perform *Get area* on *a* of *rect_1* and *b* of *rect_1*. Output it.
# Should get 20.
The OOP does not needs library, but STDIN does.