Next: , Previous: , Up: Earlemes   [Contents]


4.1.2 The earleme variables

The important earleme variables are the current earleme, the furthest earleme and the latest earleme. The current earleme is the earleme that Libmarpa is currently working on. More specifically, it is the one at which new tokens will start. Since tokens are never zero length, a new token will always end after the current earleme. The current earleme is initially earleme 0. Every call to marpa_r_earleme_complete() advances the current earleme by 1.

The furthest earleme is the highest numbered (and therefore “furthest”) earleme at which a token ends. The furthest earleme is initially earleme 0. With every call to marpa_r_alternative(), the end of the token it adds is calculated. A token ends at the earleme location current+length, where current is the current earleme, and length is the length of the newly added token. After a call to marpa_r_alternative(), the furthest earleme is its value before the call, or current+length, whichever is greater.

The latest earleme is the earleme of the latest Earley set. The latest Earley set is the last Earley set completed. This is always the highest numbered Earley set. If there is an Earley set at the current earleme, it is the latest Earley set and the latest earleme is equal to the current earleme. There is never an Earley set after the current earleme.

After every call to the marpa_r_earleme_complete() method that adds a token, the value of the latest earleme is same as the value of the current earleme. After every call to the marpa_r_earleme_complete() method that does not add a token, the value of the latest earleme is unchanged from its value before the call.


Next: , Previous: , Up: Earlemes   [Contents]