org.kiama.attribution

Attribution

object Attribution extends AttributionCore

Module for cached attributes.

Source
Attribution.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Attribution
  2. AttributionCore
  3. Memoiser
  4. AttributionCommon
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. class CachedAttribute[T, U] extends Attribute[T, U] with IdMemoised[T, Option[U]]

    An attribute of a node type T with value of type U, supported by a memo table and circularity test.

    An attribute of a node type T with value of type U, supported by a memo table and circularity test. The value of the attribute is computed by the function f. The result is memoised so that it is only evaluated once. f should not itself require the value of this attribute. If it does, a circularity error is reported by throwing an IllegalStateException.

    Definition Classes
    AttributionCore
  2. class CachedDynamicAttribute[T, U] extends CachedAttribute[T, U]

    A cached dynamic attribute of a node type T with value of type U, supported by a memo table and circularity test.

    A cached dynamic attribute of a node type T with value of type U, supported by a memo table and circularity test. The value of the attribute is initially computed by the function f, but the definition can be augmented dynamically. The result is memoised so that it is only evaluated once for a given definition. The attribute definition should not itself require the value of this attribute. If it does, a circularity error is reported by throwing an IllegalStateException. This kind of attribute encapsulates state to keep track of the current definition, so an instance should only be used from one thread at a time.

    Definition Classes
    AttributionCore
  3. class CachedParamAttribute[A, T, U] extends (A) ⇒ Attribute[T, U] with Memoised[ParamAttributeKey, Option[U]]

    A variation of the CachedAttribute class for parameterised attributes.

    A variation of the CachedAttribute class for parameterised attributes.

    Definition Classes
    AttributionCore
  4. class CircularAttribute[T, U] extends Attribute[T, U] with IdMemoised[T, U]

    An attribute of a node type T with value of type U which has a circular definition.

    An attribute of a node type T with value of type U which has a circular definition. The value of the attribute is computed by the function f which may itself use the value of the attribute. init specifies an initial value for the attribute. The attribute (and any circular attributes on which it depends) are evaluated until no value changes (i.e., a fixed point is reached). The final result is memoised so that subsequent evaluations return the same value.

    This code implements the basic circular evaluation algorithm from "Circular Reference Attributed Grammars - their Evaluation and Applications", by Magnusson and Hedin from LDTA 2003.

    Definition Classes
    AttributionCore
  5. class ConstantAttribute[T, U] extends Attribute[T, U]

    A constant attribute of a node type T with value of type U.

    A constant attribute of a node type T with value of type U. The value is given by the computation u which is evaluated at most once.

    Definition Classes
    AttributionCommon
  6. trait IdMemoised[T, U] extends MemoisedBase[T, U]

    A memoised entity that weakly holds onto its keys and uses identity to compare them.

    A memoised entity that weakly holds onto its keys and uses identity to compare them.

    Definition Classes
    Memoiser
  7. trait Memoised[T, U] extends MemoisedBase[T, U]

    A memoised entity that uses equality to compare keys.

    A memoised entity that uses equality to compare keys.

    Definition Classes
    Memoiser
  8. trait MemoisedBase[T, U] extends AnyRef

    Common interface for encapsulation of memoisation for a single memoised entity backed by a configurable cache.

    Common interface for encapsulation of memoisation for a single memoised entity backed by a configurable cache.

    Definition Classes
    Memoiser

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def attr[T, U](name: String, f: (T) ⇒ U): CachedAttribute[T, U]

    As for the other attr with the first argument specifying a name for the constructed attribute.

    As for the other attr with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCore
  6. macro def attr[T, U](f: (T) ⇒ U): CachedAttribute[T, U]

    Define a cached attribute of T nodes of type U by the function f, which should not depend on the value of this attribute.

    Define a cached attribute of T nodes of type U by the function f, which should not depend on the value of this attribute. The computed attribute value is cached so it will be computed at most once.

    Definition Classes
    AttributionCore
  7. def childAttr[T <: Attributable, U](name: String, f: (T) ⇒ (Attributable) ⇒ U): CachedAttribute[T, U]

    As for the other childAttr with the first argument specifying a name for the constructed attribute.

    As for the other childAttr with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCore
  8. macro def childAttr[T <: Attributable, U](f: (T) ⇒ (Attributable) ⇒ U): CachedAttribute[T, U]

    Define an attribute of T nodes of type U by the function f, which takes the current node and its parent as its arguments.

    Define an attribute of T nodes of type U by the function f, which takes the current node and its parent as its arguments. T must be a sub-type of Attributable so that parents can be accessed generically.

    Definition Classes
    AttributionCore
  9. def circular[T, U](name: String, init: U)(f: (T) ⇒ U): CircularAttribute[T, U]

    As for the other circular with the first argument specifying a name for the constructed attribute.

    As for the other circular with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCore
  10. macro def circular[T, U](init: U)(f: (T) ⇒ U): CircularAttribute[T, U]

    Define an optionally named circular attribute of T nodes of type U by the function f.

    Define an optionally named circular attribute of T nodes of type U by the function f. f is allowed to depend on the value of this attribute, which will be given by init initially and will be evaluated iteratively until a fixed point is reached (in conjunction with other circular attributes on which it depends). The final value is cached.

    Definition Classes
    AttributionCore
  11. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def constant[T, U](name: String, u: ⇒ U): Attribute[T, U]

    As for the other constant with the first argument specifying a name for the constructed attribute.

    As for the other constant with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCommon
  13. macro def constant[T, U](u: ⇒ U): Attribute[T, U]

    Define a constant attribute of T nodes of type U given by the value u.

    Define a constant attribute of T nodes of type U given by the value u. u is evaluated at most once.

    Definition Classes
    AttributionCommon
  14. def dynAttr[T, U](name: String, f: (T) ⇒ U): CachedDynamicAttribute[T, U]

    As for the other dynAttr with the first argument specifying a name for the constructed attribute.

    As for the other dynAttr with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCore
  15. macro def dynAttr[T, U](f: (T) ⇒ U): CachedDynamicAttribute[T, U]

    Define a cached dynamic attribute of T nodes of type U by the partial function f, which should not depend on the value of this attribute.

    Define a cached dynamic attribute of T nodes of type U by the partial function f, which should not depend on the value of this attribute. The computed attribute value is cached so it will be computed at most once.

    Definition Classes
    AttributionCore
  16. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  18. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  19. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  21. def initTree[T <: Attributable](t: T): Unit

    Initialise the Attributable tree rooted at t so that it is ready for attribution.

    Initialise the Attributable tree rooted at t so that it is ready for attribution. At present, the only initialisation performed is to set node attributes such as parent and children so that nodes can generically refer to their neighbours. If you wish to use any of these properties, you must call this method before doing so. Otherwise, the node properties should not be used and there is no need to call this method.

    Definition Classes
    AttributionCommon
  22. implicit def internalToDynamicAttribute[T, U](f: (T) ⇒ U): CachedDynamicAttribute[T, U]

    Implicitly converts functions to dynamic attributes.

    Implicitly converts functions to dynamic attributes. This conversion allows us to use simpler types for dynamic attributes, but still extend them later.

    Definition Classes
    AttributionCore
  23. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  27. def paramAttr[V, T, U](name: String, f: (V) ⇒ (T) ⇒ U): CachedParamAttribute[V, T, U]

    As for the other paramAttr with the first argument specifying a name for the constructed attribute.

    As for the other paramAttr with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCore
  28. macro def paramAttr[V, T, U](f: (V) ⇒ (T) ⇒ U): CachedParamAttribute[V, T, U]

    Define a parameterised attribute of T nodes of type U by the function f, which takes an argument of type V.

    Define a parameterised attribute of T nodes of type U by the function f, which takes an argument of type V. The computed attribute value for a given V and T pair is cached so it will be computed at most once.

    Definition Classes
    AttributionCore
  29. def resetMemo(): Unit

    Lazily reset all memoisation tables.

    Lazily reset all memoisation tables. The actual resets will only happen the next time the value of each attribute is accessed.

    Definition Classes
    Memoiser
  30. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  31. def toString(): String

    Definition Classes
    AnyRef → Any
  32. def tree[T <: Attributable, U <: Attributable](name: String, f: (T) ⇒ U): CachedAttribute[T, U]

    As for the other tree with the first argument specifying a name for the constructed attribute.

    As for the other tree with the first argument specifying a name for the constructed attribute.

    Definition Classes
    AttributionCore
  33. macro def tree[T <: Attributable, U <: Attributable](f: (T) ⇒ U): CachedAttribute[T, U]

    Define an optionally named attribute as per attr, except that the attribute must have a tree value and will be spliced into the tree to have the same parent as the node on which it is defined.

    Define an optionally named attribute as per attr, except that the attribute must have a tree value and will be spliced into the tree to have the same parent as the node on which it is defined. This kind of attribute is used to generate new trees that must share context with the node on which they are defined.

    Definition Classes
    AttributionCore
  34. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AttributionCore

Inherited from Memoiser

Inherited from AttributionCommon

Inherited from AnyRef

Inherited from Any

Ungrouped