Previous: , Up: Advanced input models   [Contents][Index]


26.2 The fully general input model

In the sparse variable-length model of input, zero or more successful calls of marpa_r_alternative() must be immediately previous to every call to marpa_r_earleme_complete(). The sparse model is the dense variable-length model, with its only restriction lifted — the sparse variable-length input model allows calls to marpa_r_earleme_complete() that are not immediately preceded by calls to marpa_r_alternative().

Since it is unrestricted, the sparse input model is Libmarpa’s fully general input model. Because of this, it may be useful for us to state the effect of mutators on the earleme variables in detail, even at the expense of some repetition.

In the sparse input model, empty earlemes are now possible. An empty earleme is an earleme with no tokens and no Earley set. An empty earleme occurs iff marpa_r_earleme_complete() is called when there is no immediately previous call to marpa_r_alternative(). The sparse model takes its name from the fact that there may be earlemes with no Earley set. In the sparse model, Earley sets are “sparsely” distributed among the earlemes.

In the dense model of input, the effect on the earleme variables of a successful call of the marpa_r_alternative() mutator is the same as for the sparse model of input:

In the sparse model, when the earleme is not empty, the effect of a call to marpa_r_earleme_complete() on the earleme variables is the same as in the dense and the basic models of input. Specifically, the following will be true:

Recall that, in the dense and basic input models, as a matter of definition, there are no empty earlemes. For the sparse input model, in the case of an empty earleme, the effect of the marpa_r_earleme_complete() mutator on the earleme variables is the following:

After a call to marpa_r_earleme_complete() for an empty earleme, the lastest and current earlemes will have different values. In a parse that never calls marpa_r_earleme_complete() for an empty earleme, the lastest and current earlemes will always be the same.


Previous: , Up: Advanced input models   [Contents][Index]