The Definite Language Reference & Guide

  1. The Basics
  2. Optionals and Nothingness
  3. The s package
  4. Types and Namespaces
  5. Primitive Methods
  6. Control Flow
  7. Classes
  8. Extensions
  9. Protocols
  10. Enums
  11. Generics
  12. Callables
  13. Threads
  14. Packages
  15. Memory Management
  16. Emojicode Engine & Compilation Specification
  17. Appendix I: The Emojicode Compiler
  18. Appendix II: Package API

The Basics

Emojicode is a language that aims to provide the most modern and powerful features to make it easy, fast and fun to write programs. These powerful features include classes, optionals, which can handle the absence of a value, generics, closures and much more.

Emojicode is a strongly typed language, which means that the compiler will verify that all of your operations are correct. This for instance prevents you from treating a number as a list of texts.

Although Emojicode only uses Emojis to express the programโ€™s structure, it is similar to programming languages you might know, like C.

Emojicode was designed to allow the development of platform independent applications by running them inside a virtual machine. Your code is first compiled to bytecode by a compiler and can then be executed. The reference implemention of such a virtual machine is called Emojicode Real-Time and can, as the name suggests, execute your code rather fast.


If you need guidance on how to use the compiler and the Real-Time Engine see โ€œCompile and Run Your First Programโ€, which is a short tutorial on writing applications in Emojicode.


You can include non-executable text in your code by marking it as a comment. Comments begin with ๐Ÿ‘ด and end at the line break.


๐Ÿ‘ด This comment ends at the end of the line. Exactly here

Multiline comments starts with ๐Ÿ‘ต and ends with ๐Ÿ‘ต and can contain line breaks.


๐Ÿ‘ต This is a multiline comment. You can even make
line breaks. ๐Ÿ‘ต

The ๐Ÿ class method

Emojicode needs to know where your program should start. The compiler will therefore look for a class method called ๐Ÿ. This method will be called on the program startup. Example:

๐Ÿ‡ โšฝ๏ธ ๐Ÿ‡
  ๐Ÿ‡๐Ÿ– ๐Ÿ โžก๏ธ ๐Ÿš‚ ๐Ÿ‡
    ๐Ÿ‘ด The code to start up the program goes here.
    ๐ŸŽ 0

If you donโ€™t understand all the code above yet donโ€™t worry, you will learn more about class methods and all this stuff in a few minutes.

When to use Emojis?

Thereโ€™s sometimes confusion when emojis are used. Basically itโ€™s very simple:

All type, method, class method and initializer names are Emojis. On the other hand variables cannot include emojis but must be any combination of characters that cannot be confused with numbers.


Variables pair a name, the variable name, with a value. The variable name can consist of any sequence of characters but may not contain spaces or emojis and may not begin with a number.

There are two types of variables: normal variables and frozen variables. Frozen variables differ from normal ones in that they cannot be changed after they were initially set.

๐Ÿฆ Declaring a Frozen Variable

The easiest way to declare and set a frozen variable at once is to use ๐Ÿฆ.

๐Ÿฆ daysInDecember 31
๐Ÿฆ approximationOf๐œ‹ 3.14159265359

The above code sets the variable daysInDecember to 31 and approximationOf๐œ‹ to 3.14159265359. These variables were declared as frozen variables as they never change.

The compiler infers the type of the variables from the values given.

๐Ÿฎ Setting and Declaring a Variable

To declare or change are normal, changeable variable you should use ๐Ÿฎ. If the variable you want to set is already declared its value will be changed, given that it is not frozen; in that particular case an error message would be emitted. Otherwise the variable is declared in the current scope.

๐Ÿฎ moneyLeft 20
๐Ÿฎ numberOfTimesโ€œSmokeOnTheWaterโ€WasPlayed 20348292837483929

These variables were justifiably declared as changeable variables because they obviously change often. You should however always prefer frozen variables if you donโ€™t intend to modify the variable.

๐Ÿฐ Declaring Variables

You can declare a variable yourself regardless if a variable with the same name was declared in the parent scope but you may not declare a variable more than one time.

๐Ÿฐ variableName variableType

variableName must be a valid variable name. variableValue may be an expression of any type.

After you declared the variable in the local scope you can use ๐Ÿฎ to set it to a value. The compiler will throw an error if you try to access an uninitialized variable. Optionals are automatically initialized to Nothingness.


Beware of that ๐Ÿฐ can shadow variables from parent scopes and can for instance make instance variables inaccessible.


Variables are only accessible from the scope in which they were declared. Every class method, method or initializer defines an own scope which disappears once the procedure has ended. A scope may also allow you to access its parent scope, which gives you the opportunity to access the variables inside that scope. Methods and initializer for instance allow you to access the parent scope, which in this case is the object scope, in which all instance variables live.

Itโ€™s important to note that unlike in other languages flow control blocks do not create a scope. If you declare a variable within an flow control it will also be available outside. This might change in future versions.

๐Ÿซ & ๐Ÿณ Incrementing and Decrementing Variables

Variables containing numbers can be incremented by using ๐Ÿซ and decremented by using ๐Ÿณ.

๐Ÿซ numberOfCats
๐Ÿณ watermelons

The above example will increment numberOfCats and decrement watermelons.

Numeric Literals

Integer literals can be written in

You can use _ within integer literals to improve readability:


The . can be used as decimal separator to create a ๐Ÿš€.

Number Types

There are only two numeric types in Emojicode:


Emojicode has a type to represent Boolean values: ๐Ÿ‘Œ. A boolean value can either be true or false. A true value is created using ๐Ÿ‘ and a false value is created using ๐Ÿ‘Ž.

In the example below two variables are set to a boolean value.

๐Ÿฆ emojicodeIsTheFunniestLanguage ๐Ÿ‘
๐Ÿฆ phpIsAsCool ๐Ÿ‘Ž

Symbol literals

A Symbol is a single Unicode character represented by the symbol type ๐Ÿ”ฃ. The symbol type can represent any character defined in Unicode.

You can include the symbol in the source code file by prepending ๐Ÿ”Ÿ before the desired symbol. This is called a Symbol literal.


๐Ÿฆ percent ๐Ÿ”Ÿ%

Context Based Parsing

Emojicode heavily uses context based parsing. This means that something can have a completely different meaning based on the context.

All statments introduced above are only valid inside a method or initializer body. If you however used ๐Ÿฆ when a type name was expected, ๐Ÿฆ would be interpreted as a type called ๐Ÿฆ.

The statment introduced below is, on the contrary, only valid at document level โ€“ you canโ€™t use it inside a method or class.

Including Other Source Code Files

You can include other source code files into a source file. Basically this just inserts the code from the file at the point where you included it.


๐Ÿ“œ string

string must be a string whose value is a path to another Emojicode source file. The path is relative to the directory which included the document with the ๐Ÿ“œ statement.


Do not use this method to share code accross projects. If you have written really fancy code, create a package, which you can easily make available to other people.

Next โ†’