Simplest example of Esprima parser

node v4.9.1
version: 1.0.3
endpointsharetweet
Load Esprima module:
var esprima = require('esprima');
Parse a specific input:
var input = 'answer = 42'; var tree = esprima.parse(input);
Show the resulting syntax tree:
console.log(JSON.stringify(tree, null, 2));
Loading…

no comments

    sign in to comment