Previous: The dense variable-length token model, Up: Advanced input models [Contents][Index]
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 specify 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:
max(old_f, old_c+length)
,
marpa_r_alternative()
,
marpa_r_alternative()
, and
marpa_r_alternative()
never changes the
latest or current earleme.
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:
old_c+1
,
where old_c is the current earleme before the call.
old_c+1
, and therefore
will be equal to the current earleme.
marpa_r_earleme_complete()
.
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:
old_c+1
,
where old_c is the current earleme before the call.
marpa_r_earleme_complete()
.
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: The dense variable-length token model, Up: Advanced input models [Contents][Index]