-
Notifications
You must be signed in to change notification settings - Fork 15
Narrow
The grammar is rewritten by local transformations such that the language generated by the grammar (or the denotation according to any other semantics for that matter) is decreased. The known rewriting rules affect the use of epsilon and regular expression operators. There are two expression arguments: one to be matched, and another one that replaces the matched expression. The scope of the transformation can be limited.
narrow:
expression expression in::scope?
The narrowing relation is defined as follows:
![narrow-equality](https://github.com/grammarware/slps/raw/master/topics/documents/wiki/narrow.png)It is possible to prove that for each case the expression on the right is included in the expression on the right, but not otherwise. For going the other way widen transformation is used. For shaping an expression into a completely equivalent one, use massage.
Given the input:
program:
fun::(function*)
After using this transformation:
narrow(
function*,
function+);
The result will look like this:
program:
fun::(function+)
- Narrow is a part of XBGF