Skip to content

Transpiling with six different languages. 🍰 🐍

Notifications You must be signed in to change notification settings

walterbm/transpyling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transpyling

A tour of transpiling and back again with six different web development languages.

Creating modern web applications requires developers that are proficient in an increasing variety of languages. Python, Ruby, and PHP are among the most popular server-side languages while JavaScript monopolizes client-side development. But there's a dream for the future of web development. A future where applications can be written once, in your favorite language, and then run everywhere.

This demo explores the reality and sacrifices of trying to chase this dream through source-to-source compiling for client-side applications.

Prepared for the annual 🐍 Fuzzy.py 🐍 extravaganza at Fuzz Productions.

Starting Point

A small python command-line program is used as the control to be transpiled into a variety of languages.

class Pie:

    def __init__(self, filling):
        self.fill_with(filling)
        self.eaten = False

    def eat(self):
        self.eaten = True

    def fill_with(self, filling):
        self.filling = filling


apple_pie = Pie('apple')
apple_pie.eat

frame = ''.join(['*' for s in xrange(28)])

print frame
print "* Who ate the %s pie?!? *" % apple_pie.filling
print frame

Conversions

  • Python (through PythonJS) ➢ JS
  • Ruby (through Opal) ➢ JS
  • JS (through js2php) ➢ PHP
  • JS (through js2py) ➢ Python
BONUS!

Execute

Install the dependencies and start the demo by running magic.sh bash script in the root directory. The script will run through all six conversions and test the resulting code.

About

Transpiling with six different languages. 🍰 🐍

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published