I think compiler is the wrong way to describe this. A computer program that translates between two different high level languages is typically called a language translator .
Brython - Python to Javascript translator
21–30 of 71 posts
Re: Brython - Python to Javascript translator
#22Re: Brython - Python to Javascript translator
#23Re: Brython - Python to Javascript translator
#24Good luck with compiling anything without having AST trees and proper parser infrastructure. In it's current state this thing won't fly.
They seem to have taken an interesting approach - it's a Javascript source file that translates the source for a restricted version of Python into equivalent Javascript constructs and then interprets that. A JS-based interpreter for Python-like text, basically. I don't think I would've implemented it this way, because: 1. It introduces the latency of having to download brython.js with every page load. 2. It supports…
Brython doesn't implement classes at all, so you're right!
Re: Brython - Python to Javascript translator
#25Good luck with compiling anything without having AST trees and proper parser infrastructure. In it's current state this thing won't fly.
They seem to have taken an interesting approach - it's a Javascript source file that translates the source for a restricted version of Python into equivalent Javascript constructs and then interprets that. A JS-based interpreter for Python-like text, basically. I don't think I would've implemented it this way, because: 1. It introduces the latency of having to download brython.js with every page load. 2. It supports…
Re: Brython - Python to Javascript translator
#26Python needs to be natively supported as a scripting lang in browsers. Google, MS, Firefox - make it so!
What browsers need to do is to have a machine-level bytecode, so that they can download whatever interpreters are needed to run the scripting code the page uses. Then pages can be written in whatever language the developer feels is best.
This is the real potential of something like Native Client - although it doesn't look like that potential will be achieved any time soon.
Re: Brython - Python to Javascript translator
#27Are there any specs as to the speed of using this? Javascript can be a bit slow on most days, does Brython make it worse?
Re: Brython - Python to Javascript translator
#28Earlier quoted context omitted.
They seem to have taken an interesting approach - it's a Javascript source file that translates the source for a restricted version of Python into equivalent Javascript constructs and then interprets that. A JS-based interpreter for Python-like text, basically. I don't think I would've implemented it this way, because: 1. It introduces the latency of having to download brython.js with every page load. 2. It supports…
The big advantage of Brython is that it has a very fast workflow, much like JavaScript. A server-side compiler approach would have a slower interactive workflow.
In terms of absolute CPU cycles burned, it's actually faster that way, since parsing happens in C using Python's built-in facilities, and the amount of JS shipped to the browser is less.
Re: Brython - Python to Javascript translator
#29Python needs to be natively supported as a scripting lang in browsers. Google, MS, Firefox - make it so!
As much as I like Python, I don't think this is the right approach. What browsers need to do is to have a machine-level bytecode, so that they can download whatever interpreters are needed to run the scripting code the page uses. Then pages can be written in whatever language the developer feels is best. This is the real potential of something like Native Client - although it doesn't look like that potential will be…
Re: Brython - Python to Javascript translator
#30But yeah. Cool stuff.