473,698 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python to JavaScript Compiler? Anyone written such a beast?

Of course, I'm not talking about something that would transform
any Python code into semantically JavaScript code, but simply
something that would analyze a "restricted " Python source file,
and spit out equivalent JavaScript. The big advantage (as far
as I'm concerned) is that one could make use of some of the
syntactic shortcuts that JavaScript doesn't offer, that the Python
syntax checker generally does a better job than the JS one, and
(perhaps most importantly) this could be configured to put in 'instrumentatio n',
such as checks to make sure than an attempt to access an undefined
attribute actually throws an error.

Color me curious,
Ken

Sep 14 '06 #1
3 1840
ke************* ***@sbcglobal.n et wrote:
Of course, I'm not talking about something that would transform
any Python code into semantically JavaScript code, but simply
something that would analyze a "restricted " Python source file,
and spit out equivalent JavaScript. The big advantage (as far
as I'm concerned) is that one could make use of some of the
syntactic shortcuts that JavaScript doesn't offer, that the Python
syntax checker generally does a better job than the JS one, and
(perhaps most importantly) this could be configured to put in 'instrumentatio n',
such as checks to make sure than an attempt to access an undefined
attribute actually throws an error.

Color me curious,
Ken
Take a look at the PyPy project, which has produced a JavaScript
back-end (thugh I suspect it's more of a curiosity than a practical
solution). It might suit your needs, though, and they've had a Summer of
Code project going on it.

http://codespeak.net/pypy/dist/pypy/doc/news.html

and specifically

http://codespeak.net/pypy/dist/pypy/...g-started.html

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden

Sep 14 '06 #2
ke************* ***@sbcglobal.n et writes:
Of course, I'm not talking about something that would transform any
Python code into semantically JavaScript code, but simply something
that would analyze a "restricted " Python source file, and spit out
equivalent JavaScript.
You may be looking for Pyjamas:

<URL:http://pyjamas.pyworks .org/>

--
\ Hercules Grytpype-Thynne: "Well, Neddie, I'm going to be |
`\ frank." Ned Seagoon: "Right, I'll be Tom." Count Moriarty: |
_o__) "I'll be Gladys." *slap* -- The Goon Show, _World War I_ |
Ben Finney

Sep 14 '06 #3

Helpfull link to JS specific docs in pypy:

http://codespeak.net/pypy/dist/pypy/doc/js/using.html

Sep 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

34
5084
by: Maboroshi | last post by:
Hello My question has to do with python and linux - I was interested in finding out what it would take to reimplement the Linux Kernel in python basically just taking the source code from linux and rewriting it in python Would this idea make sense to do - if so what would be the benefits of doing this and in what way would this not be a good idea Cheers
19
2064
by: petantik | last post by:
Where can I find a good resource, on the web, that will give me a good comprehensive idea of how to write a compiler in C for C or maybe another language. http://petantik.blogsome.com - A Lucid look at Reality ... maybe?
0
1166
by: Luke Kenneth Casson Leighton | last post by:
On Sep 3, 10:02 pm, bearophileH...@lycos.com wrote: 1200 lines of code for the compiler, and about... 800 for a basic suite of builtin types (Dict, List, set, string). http://pyjamas.sf.net so it's been done.
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.