Abstract
Treepace is a new library and a domain specific language for tree pattern matching and replacing, implemented in Python. Selected concepts resemble the well-known application programing interface (API) for string regular expressions. The language is terse since it is possible to write a simple transformation consisting of a pattern and a replacement in one row. Objects of any types can be used as node values. Calling host language constructs, e.g., functions, in the embedded language is straightforward. Node class inheritance allows for mapping tree nodes to external objects like GUI (graphical user interface) components.
Highlights
Many applications operate on tree-like data structures, consisting of nodes and edges
Objects of any types can be used as node values
THE APPLICATION PROGRAMMING INTERFACE Treepace is designed as a domain-specific language embedded in Python, so it offers the programmer a convenient Python application programing interface (API)
Summary
Many applications operate on tree-like data structures, consisting of nodes and edges. An XPath query selects a set of nodes from the tree according to a series of location steps [3]. There exist languages like XSLT and XQuery Update for this purpose The former does not fully preserve the simplicity and terseness of XPath. A tree is a special case of a graph, so it is worth mentioning a graph manipulation language Gremlin [9] It provides a succinct way of graph traversal and data filtering through a series of steps, utilizing the Java Virtual Machine. It operates on a graph database, so it is more suitable for persistent data manipulation and less for an AST transformation or document transformation
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have