Skip to content
ECMAScript parsing infrastructure for multipurpose analysis
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Migrate to CircleCI 2.0 Sep 15, 2017
.github
bin esvalidate: Ensure the consistency of error message Dec 23, 2016
dist Use webpack to create the bundle. Oct 28, 2015
docs Documentation: fix the type of some nodes. Jun 7, 2018
src Update to the latest version of TypeScript compiler, linter, and form… Dec 5, 2018
test
tools
.editorconfig Add .editorconfig Mar 11, 2015
.gitignore
.gitlab-ci.yml CI for GitLab Jun 10, 2018
.npmignore Add test to .npmignore, allow tests to pass without test Jun 23, 2015
.travis.yml
CONTRIBUTING.md Link directly to Github issue tracker. May 7, 2015
ChangeLog Update ChangeLog for 4.0.0 Jun 12, 2017
LICENSE.BSD
README.md
appveyor.yml AppVeyor CI: minor tweaks to improve dashboard clarity Dec 15, 2018
package.json
webpack.config.js

README.md

NPM version npm download Build Status Coverage Status

Esprima (esprima.org, BSD license) is a high performance, standard-compliant ECMAScript parser written in ECMAScript (also popularly known as JavaScript). Esprima is created and maintained by Ariya Hidayat, with the help of many contributors.

Features

API

Esprima can be used to perform lexical analysis (tokenization) or syntactic analysis (parsing) of a JavaScript program.

A simple example on Node.js REPL:

> var esprima = require('esprima');
> var program = 'const answer = 42';

> esprima.tokenize(program);
[ { type: 'Keyword', value: 'const' },
  { type: 'Identifier', value: 'answer' },
  { type: 'Punctuator', value: '=' },
  { type: 'Numeric', value: '42' } ]
  
> esprima.parseScript(program);
{ type: 'Program',
  body:
   [ { type: 'VariableDeclaration',
       declarations: [Object],
       kind: 'const' } ],
  sourceType: 'script' }

For more information, please read the complete documentation.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.