tag | d9d5661626c584bcfd2e85e7ac0e6a9713c2cd35 | |
---|---|---|
tagger | Ariya Hidayat <ariya.hidayat@gmail.com> | Mon Oct 31 18:33:52 2016 -0700 |
object | f404c555cd4b15b828538a2cac303d538f639dd2 |
Version 3.1.1
commit | f404c555cd4b15b828538a2cac303d538f639dd2 | [log] [tgz] |
---|---|---|
author | Ariya Hidayat <ariya.hidayat@gmail.com> | Sun Oct 30 20:21:00 2016 -0700 |
committer | Ariya Hidayat <ariya.hidayat@gmail.com> | Mon Oct 31 18:32:31 2016 -0700 |
tree | 2e35f5f19c1d0e8703b970df232c059ec0fe3d2d | |
parent | eec5780d386830600a6bc474c7642005e9df4b82 [diff] |
Stable version 3.1.1 Refs #1584 Closes gh-1611
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.
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.parse(program); { type: 'Program', body: [ { type: 'VariableDeclaration', declarations: [Object], kind: 'const' } ], sourceType: 'script' }