-
Notifications
You must be signed in to change notification settings - Fork 15
Distribute
grammarware edited this page Jan 19, 2013
·
5 revisions
Distribute sequential composition over choices so that choices are pulled out of sequences. The transformation is either attempted for all productions of a nonterminal or for a specific one appointed by its label.
distribute:
scope
In fact, distribute is nothing more than an automated version of factor that aggressively pushes all the choices that can be found in a production outwards.
This transformation is apparently non-injective, hence, it is impossible to have a complete inverse of it. A more general factor transformation, however, is as capable of emulating distribute's effect as it is capable of doing the reverse thing.
For instance,
foo:
bar (qux | wez)
After using this transformation:
distribute( in foo );
Will look like this:
foo:
bar qux
bar wez
shared/prolog/xbgf1.pro
shared/prolog/xbgf2.pro
shared/rascal/src/transform/library/Factoring.rsc
shared/xsd/xbgf.xsd
- Distribute is a part of XBGF