Skip to content

An ECMAScript 5.1 parser, written in JavaScript. The ECMAScript grammar was created using Jison.

License

Notifications You must be signed in to change notification settings

juhoojala/jsparser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsparser

An ECMAScript 5.1 parser, written in JavaScript. The ECMAScript grammar was created using Jison.

A blog post describing the project is available here. You can also test the parser online here.

Node Usage

Require the jsparser module, then simply call the parser's parse() method on a string of JavaScript source code. On success, an AST is returned. On failure, an error is thown.

var parser = require("jsparser");
var source = "console.log('Hello World!');";
var ast;

try {
  ast = parser.parse(source);
  console.log(ast);
} catch (exception) {
  console.log("Parse Error:  " + exception.message);
}

About

An ECMAScript 5.1 parser, written in JavaScript. The ECMAScript grammar was created using Jison.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Yacc 74.0%
  • JavaScript 26.0%