gabriel-weaver / xutools

eXtended UNIX text-processing tools
GNU General Public License v3.0
44 stars 2 forks source link

Augeas #1

Open gabriel-weaver opened 12 years ago

gabriel-weaver commented 12 years ago

Thank you reviewer!

From what I can see though, the goals of Augeas and XUTools are distinct though complimentary and the canonical tree representation and path expressions of Augeas are nicely aligned with the parse tree model and xupath of XUTools.

Detailed Answer:

Goals of Augeas: Augeas focuses on ways to configure Linux via an API that manipulates abstract syntax trees. The goals of Augeas and the goals of XUTools are complementary. Augeas provides a local configuration API that manipulates configuration files safely. XUTools does not focus on being a configuration API, but wants to extend existing text-processing tools. In fact, we see applications of these same tools to natural-language text documents (analysis of security policies, Classical texts, legislation), as well as to source code analysis. The final goal that Augeas lists is to make it easy to integrate new config files into the Augeas tree. This is directly compatible with our goal to grow a grammar library for use with our XUTools to accommodate a variety of use cases.

Canonical Tree Representation: The abstract tree model (a label, a value, and children), aligns very closely with our XUTools model (an ID, a label, a type, and children). In both cases, we manipulate a rooted, ordered tree. If we can add satellite data to the Augeas tree model (such as type),then we could potentially adopt the Augeas canonical tree representation when we port our XUTools to C (further evaluation would be needed, however).

Path Expressions: The path expressions of Augeas allow one to manipulate a configuration file in terms of its abstract syntax tree. These are very close to xupaths, especially when we are querying a file in terms of one schema (such as the format for /etc/hosts files that they show in the documentation). Certainly, using this Augeas library in the C implementation would again, bring much benefit to our XUTools because we would not have to reinvent the wheel and there would be nice synergy between the projects (we already have a contact at RedHat and Augeas is a RedHat Emerging Technology). One difference between the two however, is that XUTools mix and match productions from different grammars (such as "//ios:interface/builtin:line"). This allows me to extract text using one production and then to parse out some substructure using another production.

The question for the future then is to what extent can we leverage existing PyParsing, Bison, and other grammars in the Augeas lens framework? As we discuss in future work, we want to be able to parse a wide variety of grammars so that our XUTools can leverage work already done to specify a variety of programming languages. At the very least, Augeas looks promising as a set of potential libraries for the Canonical Tree Representation and Path expressions. Thank you for this reference!