Project

wood

0.0
No commit activity in last 3 years
No release in over 3 years
Wood is a library for creating, manipulating and rewriting trees, in particular Abstract Syntax Trees (ASTs). It provides an easy to use DSL for searching and rewriting whole sub-trees in place, which can be used for things like translating a parse tree into a target language tree, doing type analysis, writing compiler optimization passes and more.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Wood - Tree manipulation library

Wood is a library for creating, manipulating & rewriting trees, in particular Abstract Syntax Trees (ASTs).

Wood was extracted from a source to source compiler I worked on for Marft Inc. in 2013/14. Marft has granted me the rights to this library, so I'm releasing it under the 3-clause BSD license (see LICENSE file).

The compiler that was built using this library (which was then called Forest) translated a subset of ANSI C to multiple target languages, including Java, C# and JavaScript.

Wood provides an easy to use DSL for searching & rewriting whole sub-trees in place, which can be used for things like subsequently translating a parse tree into a target language tree (in the compiler project's case to Java::AST, CSharp::AST and JavaScript::AST trees).

You can find some example tree node definitions & rewriting rules in the examples directory.