HeartForth An Emoji Based Language
Written by Lucy Black   
Wednesday, 18 February 2015

This was thought up for Valentine's day but it isn't too late for next year! It also has some interesting technical side issues that make stack-oriented languages look attractive.

This is a simple idea. Take the stack-oriented language Forth and replace each of its commands by an emoji. As it was Valentine's day, Neil Kandalgaonkar picked gooey squishy hearts and similar emoji, but in principle you could pick any theme you care to. 

So, for example, the program:

: factorial 0 swap begin dup 1 - dup 1 = until
   begin * over 0 = until swap drop ;

5 factorial .

becomes:

heartforth1

You get the idea from just one example. 

The claimed "advantages" are: 

  • Extremely compact. Many complex programs fit in a tweet.

  • Clean visual separation between program and data. No need to syntax-highlight.

  • Whitespace agnostic.

  • Fully internationalized. Most programming languages are biased towards English speakers. Not HeartForth!

Stack-based languages like Forth are ideal for this sort of symbol swap because they have a simple syntax - nothing but operators and operands. So you don't have to invent complicated pairings of symbols as in if...then...else you can simply map operators to emoji. 

It also makes the problem of tokenization, usually the first stage in any language, trivial - no matching of strings to pick up keywords like dup, or swap or... You just scan for the Unicode. It is a bit like the old Sinclair Spectrum keyboard with each key producing a token byte for the keyword in question. 

So does it have any real use?

Probably not, but Forth, or any stack-oriented language, is something that is worth learning about. 

If you do make use of this open source project next Valentines day, I have one small piece of advice. Try to avoid the dump operator!

dump

 

Not only is it inefficient, it probably sends the wrong message!

More Information

HeartForth

Github HeartForth

Related Articles

Reverse Polish Notation - RPN       

Towards Objects and Functions - Computer Languages In The 1980s       

 

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.

 

Banner


Wasmer 5 Adds iOS Support
12/11/2024

The Wasmer team has released Wasmer 5.0. The WebAssembly runtime adds experimental support for more back ends including V8, Wasmi and WAMR. It also now has iOS support, and upgraded compilers includin [ ... ]



Ursina - A Game Engine Powered by Python
08/11/2024

Ursina is a new open source game engine in which you can code any type of game in Python, be it 2-D, 3-D, an application, a visualization, you name it.


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

 

Last Updated ( Wednesday, 18 February 2015 )