Request for opinions: A cross language development tool

2016-06-21 Thread Tal Zion

*

Hey!

I would like to know your opinions about a project a friend and I have 
been developing for about a year now, which we really think could 
empower Python. Today Python is mostly used on servers. Many people who 
want to develop an app will choose Python to write the backend and 
develop frontends in Java, Swift, Javascript, etc. We think Python is 
great, and we don't see why we shouldn't be able to write a native iOS, 
Android or web app entirely in Python. After all, these languages share 
the same concepts, more or less (classes, functions, exceptions, etc) 
and what really separates them is syntax. We're proposing a new 
approach: developers will code in their favorite language, such as 
Python (woot woot!), and be able to import Java, Swift and Javascript 
code from Python, and use that code as if it were written in Python. 
Python code will run on just about any platform, including the web.



**

So how does this magic work? We developed a new compiler platform called 
Bridge. At the heart of Bridge is the Bridge Extensible Code 
Representation (BECR). Code in any language is parsed into an AST and is 
then translated to the BECR. The BECR supports common programming 
concepts (if, for, while, etc) and it can also be extended to support 
new concepts in order to ease the translation from the source language. 
Therefore, the translation from the source language’s AST to the BECR is 
easy as it**merely translates syntax. Then, Bridge translates the BECR 
to LLVM IR and from there the code can be compiled to x86, arm, asm.js 
or any other LLVM backend*. *After code has been translated to BECR, it 
doesn’t matter what the source language was, and the syntax barriers 
that stopped languages from working together disappear. This means that 
once more languages will be translated to the BECR, they will be able to 
work seamlessly together.


**

Today, we have a basic demo showing an Android app written in Python 
displaying native Android buttons and labels inside a native scroll 
view. In this demo, Python code can import Java classes and inherit from 
them.



Soon Bridge will be released as an open source project. We’d love to 
hear your opinions about this project. We’re really excited and we can’t 
wait to see Python being used in more and more places!



**

Thanks, Tal**

*
--
https://mail.python.org/mailman/listinfo/python-list


Re: Request for opinions: A cross language development tool

2016-06-21 Thread Tal Zion

On 06/21/2016 03:39 PM, Christian Gollwitzer wrote:

Am 21.06.16 um 14:10 schrieb Tal Zion:

develop frontends in Java, Swift, Javascript, etc.

>

So how does this magic work? We developed a new compiler platform called
Bridge. At the heart of Bridge is the Bridge Extensible Code
Representation (BECR). Code in any language is parsed into an AST and is
then translated to the BECR. [.]
easy as it**merely translates syntax. Then, Bridge translates the BECR
to LLVM IR and from there the code can be compiled to x86, arm, asm.js
or any other LLVM backend*.


So you have repeated .NET, or Parrot, or the JVM. What is new in your 
system that sets it apart from these?



Soon Bridge will be released as an open source project. We’d love to
hear your opinions about this project. We’re really excited and we can’t
wait to see Python being used in more and more places!


Make sure you can do better than those:

http://ironpython.net/ (Python on .NET)
http://parrot.org/ (Python on the Perl-VM)
http://www.jython.org/ (Python on the JVM)

All of those projects promise a seamless integration of several 
languages in a single VM. ALl of them have failed in the sense that 
the languages have not converged onto that platform.


Christian


Hi Christian,
Thank you for your opinion, it is much appreciated.
There are similarities but there are also a few important implementation 
differences:


* It is easier to add languages to Bridge than it is to any of the above 
platforms: In order to make Python run on those platforms, those 
projects needed to write a compiler from Python to those platforms' 
respective intermediate languages. That is a very hard task. In Bridge, 
we provide the BECR, which makes it easy to re-use concepts implemented 
in other languages. For example, after we are done adding enough 
concepts to the BECR to compile 100% of Python's features, adding Ruby 
will be relatively easy as there are many similar concepts between the 
two languages.


* Bridge enables Python code to interact with more languages through our 
external interfaces: Bridge code can interact with libraries not 
compiled to Bridge. So Python code will be able to call Swift, 
Objective-C, Java, and C code, to name a few, even if they weren't 
compiled to Bridge.


* Bridge integrates with CPython in order to provide the same experience 
developers are used to: There are many Python modules written in C which 
are not usable in the above platforms. In Bridge you can use any CPython 
module. So when you are creating a Python list in Bridge, you are 
actually using CPython's list implementation.


* Bridge makes Python faster: Python code compiled through Bridge is 
compiled to native code. Because we are leveraging LLVM's many 
optimizations, Python code will run faster than ever.


* Bridge is more hackable: Using plugins, Bridge is much more accessible 
to community participation.


Most importantly, Bridge will enable Python code to run on many new 
platforms (iOS, Android, web browsers..), while none of the above 
platforms provide this ability. We aren't looking to compete with 
CPython, but rather to complement it.


Tal
--
https://mail.python.org/mailman/listinfo/python-list


Re: Request for opinions: A cross language development tool

2016-06-21 Thread Tal Zion
Bridge compiles Python modules into native code, which requires us to 
support Python *language* features (for, while, class, generators, etc) 
but it reuses CPython's libraries (list, dict, str, etc) so we don't 
implement those, and it also uses CPython's ast module in order to parse 
Python code. So once we are done supporting all of the language 
features, any Python code should work. Currently we have quite a few 
language features to implement, but we're working on it =) We're 
targeting Python 3.5.


Tal

On 06/21/2016 08:36 PM, Chris Angelico wrote:

On Wed, Jun 22, 2016 at 12:06 AM, Tal Zion  wrote:

* Bridge makes Python faster: Python code compiled through Bridge is
compiled to native code. Because we are leveraging LLVM's many
optimizations, Python code will run faster than ever.

Can you run *any* Python program through Bridge? Absolutely anything?
Can you guarantee language compatibility?

And if you can - what version of Python are you compatible with?

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list


Re: Request for opinions: A cross language development tool

2016-06-21 Thread Tal Zion

We use CPython's implementation of exec and eval.

Tal

On 06/21/2016 09:26 PM, Chris Angelico wrote:

On Wed, Jun 22, 2016 at 4:01 AM, Tal Zion  wrote:

Bridge compiles Python modules into native code, which requires us to
support Python *language* features (for, while, class, generators, etc) but
it reuses CPython's libraries (list, dict, str, etc) so we don't implement
those, and it also uses CPython's ast module in order to parse Python code.
So once we are done supporting all of the language features, any Python code
should work. Currently we have quite a few language features to implement,
but we're working on it =) We're targeting Python 3.5.

Okay, so how do you handle exec and eval?

ChrisA


--
https://mail.python.org/mailman/listinfo/python-list