Logo

EmojiScript

A new programming language
based on emojis.

npm i -g the-emojiscript


Get Started View on Github
Copied โœ‚๏ธ

Made with โค๏ธ by Harsh Baranwal

Editor ๐Ÿ› ๏ธ

Hurray! ๐ŸŽ‰


Documentation ๐Ÿ“ƒ


Follow these steps to install emojiscript in your system as per instructions given below.

Menu

Installation

Make sure you have already installed Node.js in your system. Write the following command in your terminal.

C:\> npm i -g the-emojiscript

This will make emojiscript globally available for you with command line tool also.


Quick Start

To check whether it is installed properly or not run emojiscript command on terminal. Now create a new file and save it with .๐Ÿ”ฅ or .emoji extension and write some peice of code.

Assume that your file named is script.emoji, to compile and run this file type following command in your terminal.

$ ๐Ÿ‘€ script.emoji

or

$ emorun script.emoji

Comment

EmojiScript supports single-line comments, begins with ๐Ÿ’ฌ. Everything after ๐Ÿ’ฌ is ignored by the compiler.

๐Ÿ’ฌ This is a comment
๐Ÿ’ฌ This is another comment

Print Function

To print the output, there is a builtin function that starts with ๐Ÿ”Š and end with โ—. Everything between this keyword will print the output as shown below.

๐Ÿ”Š "Hello, World" โ—

name = "Parth"
๐Ÿ”Š "Hello, " ๐Ÿ”— name โ—

Variable & Data Types

You can define variables using โžก๏ธ. Numbers and strings are like other languages, but null can be denoted as ๐Ÿ˜ถ. ๐Ÿ’ฏ and ๐Ÿ˜ž are the boolean value.

a โžก๏ธ 10
b โžก๏ธ 20
sum โžก๏ธ a + b
text โžก๏ธ "This is string"
c โžก๏ธ ๐Ÿ˜ถ
bool โžก๏ธ ๐Ÿ’ฏ
bool โžก๏ธ ๐Ÿ˜ž

Conditional

EmojiScript supports if-else ladder construct, ๐Ÿค” block will execute if condition is true otherwise ๐Ÿ˜Œ will execute else block.

a โžก๏ธ 10
๐Ÿค” a%2 == 0 ๐Ÿ‘‰
    ๐Ÿ”Š a ๐Ÿ”— "is a even number" โ—
๐Ÿ‘ˆ
๐Ÿ˜Œ ๐Ÿ‘‰
    ๐Ÿ”Š a ๐Ÿ”— "is a odd number" โ—
๐Ÿ‘ˆ

For Loop

It supports both loops, statements inside ๐ŸŒ€ blocks are executed as long as a specified condition evaluates to true. Once the statement become false it will break.

๐ŸŒ€ i โžก๏ธ 1, 10, 1 ๐Ÿ‘‰
    ๐Ÿ”Š "Hello, World" โ—
๐Ÿ‘ˆ

While Loop

๐Ÿค— blocks are executed as long as a specified condition evaluates to true.

i โžก๏ธ 1
๐Ÿค— i<10 ๐Ÿ‘‰
    ๐Ÿ”Š "Hello, World" โ—
    i++
๐Ÿ‘ˆ

Function

You can also make functions in EmojiScript through ๐ŸŒ and similar emoji arguments only passed after ๐ŸคŒ.

๐ŸŒ myFun ๐ŸคŒ x, y
    ๐Ÿ™ x + y

myFun ๐ŸคŒ 10, 20     ๐Ÿ’ฌ Calling a function

Built-In Functions

There are some builtin math functions โšก is for power function, ๐ŸŸฅ for square root and ๐Ÿชต for log function.

โšก 3, 2 โ—
๐ŸŸฅ 49 โ—
๐Ÿชต 10 โ—