parndt / emoruby

A little emoji language that compiles down to Ruby. "It's just ruby."

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

emoruby

A little language that compiles Emoji down to Ruby. It's just Ruby. Really.

The Language

If I were a real language designer, I would have put a lot of thought into the syntax, semantics, and structure of emoruby. Instead I basically implemented an inefficient find-and-replace from a static dictionary. (πŸ„πŸŽ©!)

Anyway, here is an example hello world program:

πŸ“‹ ❀️
  πŸ”œ πŸ‘‹
    πŸ‘€ πŸ’¬πŸ˜ƒ πŸŒπŸ’¬
  πŸ”š
πŸ”š

❀️β–ͺ️🐣β–ͺοΈπŸ‘‹

which is equivalent to this Ruby:

class Heart
  def wave
    puts "smiley earth_asia"
  end
end

Heart.new.wave

Using the gem

registering the ".emoruby" file extension

Emoruby uses polyglot to enable require to be used on .emoruby files just as you do with Ruby source .rb files. To register the file extension, simply:

> require 'emoruby'
=> true
> Emoruby.register
=> nil
> require 'hello_world'
smiley earth_asia
=> true

command line

You can run emoruby from the command line by passing an emoruby file as the first argument:

$ emoruby spec/fixtures/1_hello_world.emoruby
smiley earth_asia

API

The API allows both evaluation of emoruby code as well as translation to Ruby.

> source = "πŸ’¬πŸ˜ƒ πŸŒπŸ’¬"
=> "πŸ’¬πŸ˜ƒ πŸŒπŸ’¬"
> Emoruby.eval(source)
=> "smiley earth_asia"
Emoruby.emoji_to_ruby(source)
=> "\"smiley earth_asia\""

Versioning

The Emoruby team embraces and advocates the adoption of the the emerging iconographic versioning standard ("icover" for short).

The initial release was πŸ’© (in honor of @tenderlove's πŸ’©-lang). The next planned release is ✊.

About

A little emoji language that compiles down to Ruby. "It's just ruby."

License:MIT License


Languages

Language:Ruby 100.0%