Package-level declarations

Attribute grammars based on the Kiama library.

Please read the section on Attribute Grammars in Kiama's user manual to learn how to use this library.

Types

Link copied to clipboard
abstract class Attribute<in Node, out T> : Function1<Node, T> , ReadOnlyProperty<Node, T>

An attribute of type T for nodes of type Node.

Link copied to clipboard

Thrown when a cycle is (dynamically) detected in an Attribute definition.

Link copied to clipboard
class Tree<Node : TreeNode<Node>, out RootNode : Node>(val root: RootNode)

Computes and stores parent/child/sibling relations in a tree structure.

Link copied to clipboard
interface TreeNode<out Node>

A node in a Tree.

Functions

Link copied to clipboard
fun <Node, T> attribute(f: Node.() -> T): Attribute<Node, T>

Defines an Attribute of type T for nodes of type Node. The value of the attribute for a given Node is determined by the function f.

Link copied to clipboard
fun <Node, T> circularAttribute(initial: T, f: Node.() -> T): Attribute<Node, T>

Defines an Attribute of type T for nodes of type Node. Unlike with attribute, attribute definitions are allowed to be circular.

Link copied to clipboard

Defines an Attribute where the value of each Node is determined by the contributions from the other nodes. For every node, f specifies the contribution of that node to the other nodes. All nodes in tree are traversed to collect the attributes for each node.