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

This transformation is the reverse of deyaccify. The production rules provided as arguments must be yaccified with respect to the actual content of the grammar. If the deyaccification process on them is successful and yields the production that can be found in the grammar, it is removed and replaced by these simpler definitions of an optional or repeating nonterminal, given in BNF-only expressiveness.

Some complex yaccify cases require prior use of extract for introduction of an nonterminal for the optional or repeating phrase.

Syntax

yaccify:
        production+

Semantics

Yaccification is a typical example of grammar adaptation activity. However, it can be utilised in grammar convergence process as well: think of a situation when one of the sources is yaccified using left recursion while the other one, using right recursion. In such a case it would be better to deyaccify both of them. If this is due to some considerations impossible or undesirable, one can deyaccify, say, left recursion and then yaccify if back to right recursion.

Since it is not possible for the transformation engine to guess which kind of BNF recursion the suite user would need, yaccify takes two productions as parameters, unlike deyaccify which works perfectly just given the nonterminal name.

Example

For instance, this piece of grammar:

foo:
        bar+

can either be yaccified with left recursion:

yaccify(
 foo:
        bar
 foo:
        foo bar
);

to look like this:

foo:
        bar
foo:
        foo bar

or yaccified with right recursion:

yaccify(
 foo:
        bar
 foo:
        bar foo
);

to look like this:

foo:
        bar
foo:
        bar foo

Relevant files

See also

  • Yaccify is a part of XBGF

Contributors

Clone this wiki locally