unite - grammarware/slps GitHub Wiki

Two nonterminals, say x and y, are merged (possibly recursively). That is, the definitions of x and y (i.e., their productions) are merged in one definition while preserving the nonterminal y and replacing all occurrences of x (in the definition of x and anywhere else) by y.

Syntax

unite:
        add::nonterminal to::nonterminal

Example

Given the input:

foo:
        "a"
foo:
        "b"
bar:
        "d"

After using this transformation:

unite(bar, foo);

The result will look like this:

foo:
        "a"
foo:
        "b"
foo:
        "d"

Relevant files

See also

  • Unite is a part of XBGF

Contributors

⚠️ **GitHub.com Fallback** ⚠️