Easymoji was made by Jocelyn Tseng and Maxine Lui as the final project for the class Programming Language Pragmatics (17-363 at CMU) that took we took in our fall 2022 semester. We designed the programming language, Moji, built a compiler for it in OCaml, and created the web app Easymoji in Javascript and HTML + CSS that puts it all together!
Moji's compiler, consisting of a lexer, parser, and code generator, mirrors the structure of the micro-Typescript compiler we built over the course of the semester. The lexer turns Moji code into tokens, the parser turns tokens into an abstract syntax tree representation of the code, and the code generator turns the AST into Javascript code.
We chose to generate Javascript code because it can easily be run in the backend of the Easymoji website. After the dune compiler is run on the compiler, the code generated Javascript can be natively run in the website's JS code. Then the console output is replicated onto the frontend of the website to be displayed to the user!
- Clone this github repository
- Use your terminal to travel to the folder Easymoji/website/resources
- In your terminal, run "node app.js" to start the local server
- In your browser, head to the link "localhost:3000"
- Write easymoji code in the editor (see the Moji specification below!)
- Press compile
- Copy the output of your desired text!
easymoji.mov
All strings must be enclosed in double quotations, and each line must be ended with a semicolon.
The start of a text is denoted by the arrow "=>" and the end with a semicolon. After the arrow, you may write your text inside a pair of double quotations.
=> "Writing my text here";
You may define any string–just characters, just emojis, or a mix of both– as a macro using the let keyword. Macros can be used in texts that are anywhere after their definition. For example, the following code will define a macro, "bday", as a string of the three emojis. You will be able to use macros using their name in the same way as predefined emojis.
let bday = "🥳🎂🎉";
Our system has a couple predefined emojis (we are planning to add more!) that you can use in your texts. They can be found in the glossary below. To use them, place its name in a pair of colons within your text string.
=> "Texting with emojis! :bee: and :poop:.";
This will output as
Texting with emojis! 🐝 and 💩.
Our system also has built in emoticons that you can use in your texts! To use them, place the series of punctuation within a pair of square brackets within your text string.
=> "[:)]";
will turn into
🙂
Last but not least, we have the emoji spamming feature. Simply place a pound sign followed by a number before using an emoji to spam it.
=> "#5 :bee:";
will turn into
🐝🐝🐝🐝🐝
Users can define comments using a double backslash. They will be ignored by our compiler.
Input
let bday = "🥳🎂🎉";
// this is a comment: text for jasmine
=> "Text goes here. It may consist of words or emoticons [:)], references to the macros, :bday:, or built in emojis such as :angry: or :eyes:!!! And #5 :meditate: lol";
=> "And you can have multiple inputs at once! #3 :party:";
=> "#8 :bee:";
Output
Text goes here. It may consist of words or emoticons 🙂, references to the macros, 🥳🎂🎉, or built in emojis such as 😡 or 👀!!! And 🧘♂️🧘♂️🧘♂️🧘♂️🧘♂️ lol
And you can have multiple inputs at once! 🎉🎉🎉
🐝🐝🐝🐝🐝🐝🐝🐝
We currently have the following emojis built in:
- angry 😡
- meditate 🧘♂️
- party 🎉
- eyes 👀
- poop 💩
- bee 🐝
and the following emoticons:
- :) 🙂
- :D 😃
- :( 🙁
- :'( 😥
- <3 ❤️
- :P 😛
- ;) 😉