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. While renaming nonterminals is a syntactic sugar for the specific combination of inline and extract, it is a semantic preserving grammar transformation that is pretty-printed as renameN.

Syntax

[nonterminal] rename:
        from::nonterminal to::nonterminal

Example

Given the input:

[constant] expr:
        int
[binary] expr:
        expr op::binary_op expr
[unary] expr:
        op::unary_op expr

After using this transformation:

renameN(expr, exp);

Will look like this:

[constant] exp:
        int
[binary] exp:
        exp op::binary_op exp
[unary] exp:
        op::unary_op exp

Relevant files

See also

  • RenameN is a part of XBGF

Contributors

Clone this wiki locally