org.kiama.attribution.AttributionCore

CircularAttribute

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. 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.

Source
AttributionCore.scala
Linear Supertypes
AttributionCore.IdMemoised[T, U], AttributionCore.MemoisedBase[T, U], Attribute[T, U], (T) ⇒ U, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. CircularAttribute
  2. IdMemoised
  3. MemoisedBase
  4. Attribute
  5. Function1
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CircularAttribute(name: String, init: U, f: (T) ⇒ U)

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

    Definition Classes
    Any
  6. def andThen[A](g: (U) ⇒ A): (T) ⇒ A

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  7. def apply(t: T): U

    Return the value of this attribute for node t.

    Return the value of this attribute for node t. Essentially Figure 6 from the CRAG paper, plus the READY optimisation (section 3.3).

    Definition Classes
    CircularAttribute → Function1
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. def compose[A](g: (A) ⇒ T): (A) ⇒ U

    Definition Classes
    Function1
    Annotations
    @unspecialized()
  11. def dup(t1: T, t2: T, u: U): Unit

    Duplicate an entry if possible.

    Duplicate an entry if possible. If t1 has a memoised value associated with it, set the value associated with t2 to the same value. If there is no value associated with t1, set the value associated with t2 to u.

    Definition Classes
    MemoisedBase
  12. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def get(t: T): Option[U]

    Return the value stored at key t as an option.

    Return the value stored at key t as an option.

    Definition Classes
    MemoisedBase
  16. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  17. def getWithDefault(t: T, u: U): U

    Return the value stored at key t if there is one, otherwise return u.

    Return the value stored at key t if there is one, otherwise return u.

    Definition Classes
    MemoisedBase
  18. def hasBeenComputedAt(t: T): Boolean

    Has the value of this attribute at t already been computed or not?

    Has the value of this attribute at t already been computed or not?

    Definition Classes
    CircularAttributeMemoisedBase
  19. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. val memo: Cache[AnyRef, AnyRef]

    The memo table.

    The memo table.

    Definition Classes
    IdMemoisedMemoisedBase
  22. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  25. def put(t: T, u: U): Unit

    Store the value u under the key t.

    Store the value u under the key t.

    Definition Classes
    MemoisedBase
  26. def putIfNotPresent(t: T, u: U): Unit

    Store the value u under the key t if t does not already have an associated value.

    Store the value u under the key t if t does not already have an associated value.

    Definition Classes
    MemoisedBase
  27. def reportCycle(t: T): U

    Report a cycle in the calculation of this attribute discovered when evaluating the attribute on value t.

    Report a cycle in the calculation of this attribute discovered when evaluating the attribute on value t. Throws an IllegalStateException.

    Definition Classes
    Attribute
  28. def reset(): Unit

    Immediately reset this attribute's memoisation cache.

    Immediately reset this attribute's memoisation cache.

    Definition Classes
    CircularAttributeMemoisedBase
  29. def resetAt(t: T): Unit

    Immediately reset the memo table at t.

    Immediately reset the memo table at t.

    Definition Classes
    MemoisedBase
  30. def resetIfRequested(): Unit

    Check to see if a reset has been requested via the common memo version, and if so, do it.

    Check to see if a reset has been requested via the common memo version, and if so, do it.

    Definition Classes
    MemoisedBase
  31. def safef(t: T): U

    Run the semantic function f in a safe manner.

    Run the semantic function f in a safe manner. We need to guard against f throwing an exception which aborts the computation, since we could then leave the global circular attribute state in a funny state.

  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  33. def toString(): String

    The attribute's string representation is its name.

    The attribute's string representation is its name.

    Definition Classes
    Attribute → Function1 → AnyRef → Any
  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.IdMemoised[T, U]

Inherited from AttributionCore.MemoisedBase[T, U]

Inherited from Attribute[T, U]

Inherited from (T) ⇒ U

Inherited from AnyRef

Inherited from Any

Ungrouped