JavaScript parser in Python
Peter Hansen
peter at engcorp.com
Wed Jun 4 09:08:29 EDT 2003
Frantisek Fuka wrote:
>
> Ian Bicking wrote:
> > On Wed, 2003-06-04 at 02:32, Carl Waldbieser wrote:
> >
> >>Does anyone know of a Python module that can parse a JavaScript source file?
> >>I am intersted in checking the file to see if it is syntactically correct,
> >>as well as possibly stripping out whitespace and comments. I found a couple
> >>JavaScript compression utilities after doing a Google search, but many of
> >>them are themselves written in JavaScript, execute in a browser, and tend to
> >>be somewhat slow for very large JavaScript files. A pythonic solution has a
> >>certain appeal to me because I have always found Python very easy an
> >>intuitive to use in the past. Thanks in advance.
> >
> >
> > Well, I think that Javascript has tokens that pretty much match
> > Python's, except for whitespace. That at least would make compression
> > fairly easy, though a more general parser would be able to do more.
>
> And what about Python script that could disassemble the compiled Java
> file into the primitive "Java-assembler" instructions? (i.e. not Java
> source)
Just to clarify, in case you weren't aware "Frantisek": Java is *not*
related to Javascript. The two are very different beasts and have next
to nothing in common.
-Peter
More information about the Python-list
mailing list