Skip navigation links

Package fabric.ast

New AST nodes for the Fabric language extension.

See: Description

Package fabric.ast Description

New AST nodes for the Fabric language extension. This package also includes with all of the node, extension, and delegate factories.

Extension Factory Classes

There are a number of factory classes associated with building the extension objects. As documented in the CC'03 Polyglot paper, there should be a separate extension object for each language extension. In the case of Fabric (which is an extension of Jif), a properly constructed fabric node should look as follows:

The node itself will be created by a FabricNodeFactory_c object, and the delegate will be created by a FabricDelFactory_c object, but the extension class factories are a little more complicated.

All of the extension factories implement the FabricExtFactory interface, even those that produce Jif extensions rather than FabricExt extensions. The FabricExtFactory interface simply designates a factory that is able to create extensions for all of the Fabric AST nodes.

The FabricJifExtFactory_c class is responsible for creating all of the Jif extensions in the diagram above. It is a simple extension of the JifExtFactory_c that is able to construct Jif extensions for atomic sections (and any other new AST nodes we may add).

The AbstractFabExtFactory_c class is a skeleton implementation of the FabricExtFactory interface that takes care of chaining extension objects together (much like the polyglot.ast.AbstractExtFactory_c and the jif.ast.AbstractJifExtFactory_c classes). It delegates the actual creation of the extension objects to extFooImpl() methods, which by default simply call the parent factory methods.

Finally, the FabricFabExtFactory_c class creates all of the FabricExt classes in the above diagram. It extends the AbstractFabExtFactory_c class and overrides some of the extFooImpl methods to create the actual extension objects used by fabric.

Here is a diagram showing how it all fits together:

Skip navigation links