JavaScript parser in Python

Ian Bicking ianb at colorstudy.com
Wed Jun 4 06:55:44 CEST 2003


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.

  Ian







More information about the Python-list mailing list