Skip to content

Interact with parsed code trees using familiar selector patterns

Notifications You must be signed in to change notification settings

syntaxable/parsetree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

ParseTree

Because syntax trees are difficult to use.

Syntaxable's ParseTree provides a wrapper layer that makes it easy to interact with parsed code using selector patterns that are familiar and comfortable. (Think jQuery for your parsed code tree)

Available for the following languages:

Language Package Available Selectors
JavaScript parsetree-js glossary
HTML
CSS
...

Specification and Standards

View the Specification for the ParseTree Interaction Layer

Code is so much more than a String. It has form and structure that makes it possible for a machine to understand and execute precise instructions. Sadly, many of our development tools operate on source files as simple strings and we lose the ability to understand our own code during processing steps. Even when we do have access to parsed trees we avoid using them because they are deeply nested and difficult to traverse.

Our goal is to create a standard way to interact with parsed code trees in a reliable and intuitive manner that applies across all languages. Manipulating and transforming source code should be easy and approachable for developers of all levels and backgrounds.

Examples

JavaScript

let code = fs.readFileSync('./src/program.js', 'utf8');
let $ = new ParseTree(code);
let allFns = $.find('FunctionDeclaration');
allFns.each((fn) => {
    console.log(fn.name);
});

About

Interact with parsed code trees using familiar selector patterns

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published