Demonstrations

Parsing and Tree Traversal

The trace-deps-tree demo is a node.js program that demonstrates the following:

The program is available at demo/trace-deps-tree in the bdParse repo. See the commentary at the top of demo/traverse-deps-tree/main.js for details

More Parsing and Tree Traversal

For a real-world use of bdParse, consider the bdBuild program. bdBuild parses Javascript resources here. Then the resulting abstract syntax trees are traversed to discard all dead code resulting from static has.js values known at build time here and discover AMD module dependencies here. The techniques used in these modules are exactly the same as those used in the demonstration above. Once you understand how to traverse the trees, it is possible to build exciting and powerful applications based on source code semantics.