Anonymize - grammarware/slps GitHub Wiki
This operator is the reverse of deanonymize that strips one (marked) selector from an existing definition.
Given the input BGF and a clear goal to strip all selectors, it becomes trivial to generate a list of anonymize commands that, if executed on the same grammar, would produce a selector-free yet structurally equivalent grammar. We used such a generator called strips in the FL case study as the final stage to converge the abstract syntax (with selectors) with the concrete syntax (with terminals), see the section about generators.
Syntax
anonymize:
marked-production
Example
Given the input:
[binary] expr:
"(" expr op::binary_op expr ")"
[unary] expr:
op::unary_op expr
After using this transformation:
anonymize(
[unary] expr:
<op::unary_op> expr
);
Will look like this:
[binary] expr:
"(" expr op::binary_op expr ")"
[unary] expr:
unary_op expr
Relevant files
See also
- Anonymize is a part of XBGF