Skip to content
grammarware edited this page Jan 18, 2013 · 5 revisions

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.

Syntax

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.

Example

Given the input:

program:
        fun::(function*)

After using this transformation:

narrow(
 function*,
 function+);

The result will look like this:

program:
        fun::(function+)

Relevant files

See also

  • Extract is a part of XBGF
Clone this wiki locally