User Tools

Site Tools


01_user_documentation:07_rgg_xl:02_xl:04_production:02_operator

Operators

Each node expression is prefixed by an operator. Both together constitute a single production statement which passes the result of the node expression to the current producer. In the simplest case, node expressions are prefixed by whitespace only, which is an operator.

The list of available operator is defined in the XL specification. Operators have the same syntactical priority and are applied in the order in which they appear.

Common operator in RGG

Here is a list of some commonly used operator and their result in RGG:

Operator Example Result
Node Node Link the two nodes by a directed Successor edge
> Node > Node Link the two nodes by a directed Successor edge
+> Node +> Node Link the two nodes by a directed Branch edge
/> Node /> Node Link the two nodes by a directed Refinement edge
-e-> Node -5-> Node Link the two nodes by a directed edge with the edge bit of e

Note: all the operator above can be applied with their “reverse” form, in order to create a directed edge of the other direction. E.g. +> can be <+.

Custom operator

It is possible to declare and use custom operator from methods of the Producer. These operators have the following syntax:

-custom-> n -custom(3)-> m

is translated to

p.custom(n).custom(m, EdgeDirection.FORWARD, 3)

In that example, custom is the name of the operator. A method with that name, and which return a Producer of the same type have to be defined in the producer that execute this statement.

The methods get:

  • one argument: the Node on the right if no parenthesis
  • three arguments: the Node, the EdgeDirection, and a int.

Example

The following production statement:

==> Node > Node;

is translated for the producer p as :

p.operator$whitespace(new Node()).operator$rt(new Node());
01_user_documentation/07_rgg_xl/02_xl/04_production/02_operator.txt · Last modified: 2025/08/20 12:58 by gaetan