GithubHelp home page GithubHelp logo

parndt / emoruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from searls/emoruby

0.0 0.0 0.0 143 KB

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

License: MIT License

Ruby 100.00%

emoruby's Introduction

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 โœŠ.

emoruby's People

Contributors

searls avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.