As a simple example, imagine a language of identity statements of the style
total=price+tax+shipping tax=price×10÷100 shipping=5
expressed by this grammar that uses the definition of
expr
from another module:
+uses expr from expr.ixml data: identity+. identity: id, -"=", expr, -#a. id: [L]+.
The only problem is that the expr
module has a
clashing rule for id
:
+shares expr expr: id++op. id: [L; Nd]+. op: ["+-×÷"].
Since the invoking grammar never gets changed, the rule in the module gets renamed, resulting in the following complete grammar:
data: identity+. identity: id, -"=", expr, -#a. id: [L]+. expr: id_++op. id_>id: [L; Nd]+. op: ["+-×÷"].
If the module's rule for id
had instead been a
renaming, it could have looked like this:
id>ident: [L; Nd]+.
and the renaming would have ended up as:
id_>ident: [L; Nd]+.