Semantic actions

A semantic action defines additional processing on abstract tree nodes. For example, you can enable a node to perform semantic checking, or to declare variables and variable scope.

Deprecated feature:

Deprecation icon Support for custom business rule languages is deprecated in V8.8.1. This feature will be removed in a future release of the product. See Deprecated features for migration details.

During the process of building the syntax tree, some nodes might require additional processing, for example, to perform semantic checking or to declare variables and variable scope. You define this processing using semantic actions.

A semantic action is a Java™ object that can be attached to an element of the abstract syntax, with the property semanticAction. The value of this property is the name of a Java class that extends the abstract class IlrBRLSemanticAction. This class defines an abstract method apply, with the following signature:

public abstract void apply(IlrBRLSemanticContext context, 
   IlrSyntaxTree.Node node);

This method is called when a rule is parsed, every time an instance of the syntax tree node where the semantic action is attached is added to the syntax tree.

This method has the following arguments:

You can declare the implementation of this method to nodes of the abstract grammar:

<type>.<name>.semanticAction = [class-name]

or

<type>.semanticAction = [classname]