Skip to content
/ esprima Public
forked from jquery/esprima

ECMAScript parsing infrastructure for multipurpose analysis

License

Notifications You must be signed in to change notification settings

ariya/esprima

This branch is 1 commit ahead of, 5 commits behind jquery/esprima:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f738147 · Jun 14, 2021
Jun 14, 2021
Dec 23, 2016
Oct 28, 2015
Sep 27, 2020
May 8, 2021
May 15, 2021
May 15, 2021
Apr 14, 2018
Mar 11, 2015
May 8, 2021
Nov 17, 2015
May 29, 2020
May 7, 2015
Jun 12, 2017
Nov 8, 2016
Jun 11, 2021
May 8, 2021
May 8, 2021
Oct 28, 2015

Repository files navigation

NPM version npm download Tests 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.

About

ECMAScript parsing infrastructure for multipurpose analysis

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 70.4%
  • JavaScript 29.6%