-
Notifications
You must be signed in to change notification settings - Fork 15
ImportG
Allows to import another grammar: the nonterminals within it can refer to one another, but none of the existing productions are allowed to refer to them before this transformation takes place.
import:
production+
Consider a scenario where we want to introduce two production rules, each defining a fresh nonterminal symbol, and each using the other. Without import the only way to do so would be to run one introduce and one define, which is semantically wrong since we are sure that before the first nonterminal is introduced, the second one was fresh. So, instead we take the interdependent productions together and introduce them in one step.
Technically, import can be used any time to substitute any number of introduce transformations. Whether this is a desired use pattern or not, is left at the discretion of the language engineer.
For instance,
X:
"a" "b"
After using this transformation:
import(
A:
B X
B:
A
ε
);
It will look like this:
X:
"a" "b"
A:
B X
B:
A
ε
- ImportG is a part of XBGF