“This is the 27th day of my participation in the First Challenge 2022. For details: First Challenge 2022”

Most programming languages are created to satisfy some real need, but some are just artistic statements. One such artistic claim is the Emojicode language — which bills itself as “a full-fledged programming language made of Emojis”.

Hello World

Let’s start by writing Hello World:

💭𝔀𝓸𝔀
🏁 🍇
  😀 🔤🄷🄴🄻🄻🄾, 🅆🄾🅁🄻🄳🔤❗️
🍉
Copy the code

As you can see, the usual keywords have been replaced by emojis:

  • 💭 is the comment line
  • 🏁 🍇🍉 is the main function
  • 🔤 is like quotation marks
  • 😀❗️ is like printing
  • Generally, ❗️ ends the parameter list

The contents of strings and annotations aren’t necessarily emoticons, but I also spice them up with my app to make fancy text.

variable

We can use ➡️ to put things into variables. The variable is on the right, which is a fairly unconventional choice, but not entirely unheard of. 🧲 for string interpolation:

🏁 🍇 🔤 ⓔ ⓥ ⓔ ⓡ ⓨ ⓞ ⓝ ⓔ 🔤 ➡ ️ who 😀 🔤 🄷 🄴 🄻 🄻 🄾, 🧲 who 🧲 🔤 ❗🍉Copy the code

List and for loops

List by 🍿🍆. I got the first emoji and am not so sure about the second.

You can use the loop 🔂 iterator list 🍇 body 🍉, which is a nice loop emoji:

🏁 🍇 🍿 🔤 Python 🔤 🔤 JavaScript 🔤 🔤 Ruby 🔤 🔤 Emojicode 🔤 🔤 PHP 🔤 🍆 ➡ ️ languages 😀 🔤 Most important languages to Learn 🔤❗️ 🔂 language Languages 🍇 😀 language❗️Copy the code

FizzBu​​zz

We also need to prepare a few things in advance here.

🔂 variable 🆕⏩ start afterend step equivalent to (start, afterend, Step) range loop I 🚮 15 🙌 0 equivalent to I % 15 == 0 ↪️, 🙅 🙌 and 🙌 equivalent to if, else if and else With it, we can either write a FizzBuzz or use fancy fonts for output:

🏁 🍇 🔂 I 🆕 service1 101 1 ❗ 🍇
    ↪️ i 🚮 15 🙌 0 🍇
      😀 🔤𝔽𝕚𝕫𝕫𝔹𝕦𝕫𝕫🔤 ❗
    🍉
    🙅↪️ i 🚮 3 🙌 0 🍇
      😀 🔤𝔽𝕚𝕫𝕫🔤 ❗
    🍉
    🙅↪️ i 🚮 5 🙌 0🍇 😀 🔤 𝔹 𝕦 𝕫 𝕫 🔤 ❗ 🍉 🙅 🍇 😀 🔤 🧲 I 🧲 🔤 ❗ 🍉 🍉 🍉Copy the code

function

There’s one more thing we need to know — functions.

I’m a little confused, the documentation doesn’t say anything about the function. It has closures, so we think this might work:

🏁 🍇 🍇 I 🔢 commit commit 🔢 ↩️ I archtadi🍉 commit commit double 🔢 ️ double21❗ 🧲 🔤 ❗ 🍉Copy the code

We need to declare the type. 🔢➡️🔢 accepts an integer and returns an integer. ↩️ is the payoff. ⁉ ️… ❗ is a function call. Not bad.

Y combinator fails

Unfortunately these don’t recurse, so this doesn’t work at all!

🏁 🍇 🍇 n 🔢 disk 🏁 🏁 n 🏁3🍇 ↩1🍉🙅🍇 💭 Does not work 🙅 🙅 ️ fib n ➖1❗ ➕ ⁉ ️ fib n ➖2❗ 🍉 🍉 ➡️ fib 🍉 login time ️ fib5❗ 🧲 🔤 ❗ 🍉Copy the code

I’ve considered using the old Lisp trick and passing fib closures as arguments so that it can call itself, but this only works if there are no stupid types getting in the way. The type system might support the Y combinator if it supports recursive types, but I don’t think Emojicode does.

Classes

Its documentation doesn’t say anything about functions, but it does have classes. So let’s use the method 🚀 to define the class 🤖 to do fib:

🐇 🤖 🍇 🆕🍇 🍉 ❗️ 🚀 n 🔢 🔢 🍇 ↪️ n recruitment3🍇 ↩1🍉 🙅 🍇 ↩🚀 👇 n ➖1❗ ➕ 🚀 👇 n ➖2❗ 🍉 🍉 🍉 🏁 🍇 🆕🤖❗️ fib 🔂 I 🆕⏩1 31 1❗ 🍇 🚀fib I ❗️ x 😀 🔤🧲x🧲🔤❗ 🍉 🍉Copy the code

If you’ve done some research, this code shouldn’t be too difficult to understand.

  • 🆕🤖❗️ port fib- Creates a new PORT OF X and assigns it to the fib variable
  • 🚀fib I ❗️ ➡️ x- Call the service fib on the instance, calling our unique method I with arguments
  • 🐇 🤖 🍇🍉- Define a class named 🤖 (the class name must be an emoji)
  • 🆕🍇🍉- Empty constructors, we need to create some constructors for each class, even if it doesn’t do anything
  • ❗️ 🚀 n 🔢 doctor ❗🍉- Define method 🚀❗️ takes an integer argument n and returns an integer
  • ↩🚀 👇 n ➖ 1 ❗ ➕ 🚀 👇 n ➖ ❗ – recursive calls, 2 🚀 👇 n ➖ ❗ is this 1. 🚀 (n – 1) is more commonly used language

A unified code

This language was certainly created as an artistic statement (or as a joke, if you prefer), but it raises an important question. Throughout the history of programming, almost all languages (APL and Raku are the most notable exceptions, don’t worry — we’ll definitely cover both in this series) have been limited to plain text with ASCII characters.

Even ASCII symbols are clearly not enough, so symbols are reused to represent ten different things (try to list all the syntactic meanings of characters in JavaScript or indeed almost any language), and long strings like {} are used to fake extra characters. ! * * = = =

So the question is – should programming languages continue to limit themselves to ASCII, or is it finally time to embrace Unicode as a whole? An interesting middle ground is hyphenated fonts like Fira Code – the source Code still says! ==, but in the editor you will see ≢.

✨ is written at the end

Want to see what I’m doing? Check out my personal website and GitHub

Need a top-tier full-stack developer freelancer to eliminate your development dilemmas? Contact information can be obtained from the blogger’s nuggets homepage, remember to note nuggets 👉👉👉 juejin.cn/user/204034…