kiama.attribution

trait Attribution

[source: kiama/attribution/Attribution.scala]

trait Attribution
extends AttributionBase
Attribution of syntax trees in a functional style with attribute values cached so that each value is computed at most once.
Direct Known Subclasses:
Attribution

Method Summary
def attr [T <: AnyRef, U](f : scala.PartialFunction[T, U]) : scala.PartialFunction[T, U]
Define an 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.
def childAttr [T <: Attributable, U](f : (T) => scala.PartialFunction[Attributable, U]) : scala.PartialFunction[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. T must be Attributable so that parents can be accessed.
def paramAttr [TArg, T <: AnyRef, U](f : (TArg) => scala.PartialFunction[T, U]) : (TArg) => scala.PartialFunction[T, U]
Define an attribute of T nodes of type U by the function f, which takes an argument of type TArg. The computed attribute value for a given TArg is cached so it will be computed at most once.
def resetMemo : Unit
Lazily reset all memoisation tables.
Methods inherited from AttributionBase
circular, constant
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
class CachedAttribute [T <: AnyRef, U](f : scala.PartialFunction[T, U]) extends scala.PartialFunction[T, U]
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.
class CachedParamAttribute [TArg, T <: AnyRef, U](f : (TArg) => scala.PartialFunction[T, U]) extends (TArg) => scala.PartialFunction[T, U]
A variation of the CachedAttribute class for parameterised attributes.
Method Details
def resetMemo : Unit
Lazily reset all memoisation tables.

def attr[T <: AnyRef, U](f : scala.PartialFunction[T, U]) : scala.PartialFunction[T, U]
Define an 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.

def paramAttr[TArg, T <: AnyRef, U](f : (TArg) => scala.PartialFunction[T, U]) : (TArg) => scala.PartialFunction[T, U]
Define an attribute of T nodes of type U by the function f, which takes an argument of type TArg. The computed attribute value for a given TArg is cached so it will be computed at most once.

def childAttr[T <: Attributable, U](f : (T) => scala.PartialFunction[Attributable, U]) : scala.PartialFunction[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. T must be Attributable so that parents can be accessed.