0.2.1 • Published 11 years ago
analyses v0.2.1
analyses
Basic data flow analyses framework based on esprima
Installation
$ npm install analyses
Usage
var cfg = esgraph(esprima.parse('…'));
var output = analyses(cfg, function (input, list) {
this; // the cfg node
input; // the input set
list; // the worklist `.push()` nodes to it.
return new analyses.Set(); // either return a new output Set
// or return an output Set and `enqueue: false` so the worklist algorithm does
// not check and enqueue successors itself.
return {output: new analyses.Set(), enqueue: false}
}, {
// direction:
// forward or backward; defaults to forward
direction: 'forward',
// custom merge function:
// typically union or intersect; defaults to union
merge: analyses.Set.union,
// custom equals function:
// this is used to determine if the output of a node still changes and to
// not enqueue any more successors and stop the iteration; defaults to
// Set.equals
equals: analyses.Set.equals
});
License
LGPLv3