RAssoc - grammarware/slps GitHub Wiki
This transformation operator replaces an iterative production found in the grammar by the argument production, which is a right associative repeating equivalent of the former. Its defining expression involves a pattern of binary recursion with regard to the defined nonterminal. The “r” in “rassoc” refers to the intended effect at the level of derivation trees: the list of subtrees is to be converted into a nested binary tree in a right-associative manner.
Syntax
rassoc:
production
Example
For instance,
[constant] expr:
int
[binary] expr:
expr (op expr)*
After using this transformation:
rassoc(
[binary] expr:
expr op expr
);
Will look like this:
[constant] expr:
int
[binary] expr:
expr op expr
Relevant files
shared/prolog/xbgf1.pro
shared/prolog/xbgf2.pro
shared/rascal/src/transform/library/Associativity.rsc
shared/xsd/xbgf.xsd
See also
- RAssoc is a part of XBGF