EmLang stands for βEmoji Languageβ. It is a proof of concept. It proves that programming languages are formal. And the symbols themselves don't matter. We can use any symbol (Emoji included) to code.
EmLang is implemented in Haskell. It is a project I made for UIUC CS421 Programming Languages and Compilers. It is based heavily on the Forth language, which you can check out here https://www.forth.com/forth/. EmLang borrowed the framework and starter code from one of the MPs we did for this class. The original MP source code is confidential.
Setting up is very easy if you use Docker.
- Pulled the latest Haskell image:
docker pull haskell
- Start the container based on that image
- Clone this repository inside of a directory in the container
- Run
stack repl
to start the Haskell repl - Enter
main
and hit enter to start the EmLang compiler - Viola!
Instead of running stack repl
, run stack test
which will run all of the test cases.
Printing is easy in EmLang! Just do π¨οΈ to print and pop the top of the stack, or π¨οΈπ to print the entire stack!
For example, to print the current stack:
To print and pop the top element of the stack:
And now the stack looks like this:
The following block of code defines a "max" function which returns the biggest of the two give integers.
βοΈπ max πͺ βοΈ πͺ βοΈ πβοΈ π€ π π€ π¦ π
Running the max function:
Of course, since this is EmLang, it is recommended that you define functions in Emojis too! We should define the above max function with the πΆ emoji:
βοΈπ πΆ πͺ βοΈ πͺ βοΈ πβοΈ π€ π π€ π¦ π
And the results of calling our new πΆ function is:
Happy coding in EmLang!