RenameS
grammarware edited this page Jan 19, 2013
·
5 revisions
Labels, nonterminals, selectors and terminals can be renamed. Being in line with the fundamental notion of renaming, such renaming must be done consistently throughout the entire grammar, without introducing any clashes. There is one justifiable exception. That is, arguably, the scope of selectors is the level of production as opposed to necessarily the entire grammar. Hence, selectors can be renamed in such a scope, optionally.
Selectors can also be renamed by a semantic preserving grammar transformation that is pretty-printed as renameS. This variant is a syntactic sugar for the specific combination of anonymize and deanonymize.
[selector] rename:
in::label? from::selector to::selector
Given the input:
[constant] expr:
int
[binary] expr:
expr op::binary_op expr
[unary] expr:
op::unary_op expr
After using this transformation:
renameS(op, operator);
Will look like this:
[constant] expr:
int
[binary] expr:
expr operator::binary_op expr
[unary] expr:
operator::unary_op expr
shared/prolog/xbgf1.pro
shared/prolog/xbgf2.pro
shared/rascal/src/transform/library/Labels.rsc
shared/xsd/xbgf.xsd
- RenameS is a part of XBGF