-
Notifications
You must be signed in to change notification settings - Fork 15
RenameL
grammarware edited this page Jan 18, 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.
Renaming labels is a semantic preserving grammar transformation pretty-printed as renameL. Given two label names, it simply searches the grammar for productions with the original label and re-designates them with the new one.
renameL
is essentially syntactic sugar for the specific combination of unlabel and designate.
[label] rename:
from::label to::label
Given the input:
[constant] expr:
int
[binary] expr:
expr op::binary_op expr
[unary] expr:
op::unary_op expr
After using this transformation:
renameL([binary], [binary_expr] );
Will look like this:
[constant] expr:
int
[binary_expr] expr:
expr op::binary_op expr
[unary] expr:
op::unary_op expr
- Extract is a part of XBGF