Skip to content
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.

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.

Syntax

[label] rename:
        from::label to::label

Example

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

Relevant files

See also

  • RenameL is a part of XBGF

Contributors

Clone this wiki locally