-
Notifications
You must be signed in to change notification settings - Fork 15
RemoveH
Horizontal removal looks inside productions: it removes any marked part of an internal choice, getting rid of the choice altogether if necessary (if the removed part was one of two alternatives). This allows to skip pre-transformational vertical and post-transformational horizontal steps for productions with a top-level choice, which is the most common use of this transformation. However, it is useful to have a command at hand that is capable of removing alternatives from any particular place of any grammar production rule.
[horizontal] remove:
marked-production
Markers must denote the part to be removed: i.e., the production with the marked part must be present in the grammar, and if it is, the result will contain a production without the marked part instead. Obviously, the markers itself do not end up in the grammar.
Given the input:
foo:
"x"
bar
wez
After using this transformation:
removeH(
foo:
<"x">
bar
wez
);
The result will look like this:
foo:
bar
wez
Given the input:
expr:
("+" | "-")? int
After using this transformation:
removeH(
expr:
(<"+"> | "-")? int
);
The result will look like this:
expr:
"-"? int
- RemoveH is a part of XBGF