Esprima

# Esprima ECMAScript parsing infrastructure for multipurpose analysis

Esprima (esprima.org) is an educational ECMAScript (also popularly known as JavaScript) parsing infrastructure for multipurpose analysis. It is also written in ECMAScript.

Esprima serves as a good basis for various tools such as source modification (Esmorph), coverage analyzer (node-cover and coveraje), source-to-source compiler (Marv), syntax formatter (Code Painter), and code generator (escodegen).

Esprima can be used in a web browser:

    <script src="esprima.js"><script>

or in a Node.js application via the package manager:

    npm install esprima

Esprima parser output is compatible with Mozilla (SpiderMonkey) Parser API.

A very simple example:

    esprima.parse('var answer=42').body[0].declarations[0].init

produces the following object:

    { type: 'Literal', value: 42 }

Esprima is still in the development, for now please check the wiki documentation.

Since it is not comprehensive nor complete, refer to the issue tracker for known problems and future plans. Esprima is supported on many browsers: IE 6+, Firefox 1+, Safari 3+, Chrome 1+, and Opera 8+.

Feedback and contribution are welcomed! Please join the mailing list and read the contribution guide for further info.