Next: Per-rule events, Previous: Event coincidence of symbols, Up: Events [Contents][Index]
A marker symbol is a nulling symbol introduced for
the purpose of “marking” a position in a rule.
If a MARPA_EVENT_SYMBOL_NULLED event is
activated for the marker symbol,
an event instance will be triggered whenever that
position in the rule is reached.
For example, consider the rule
[ A ::= Y Z ]. (R1)
If we replace (R1) with the following
rules
[ Mk0 ::= ]
[ Mk1 ::= ]
[ Mk2 ::= ]
[ A ::= Mk0 Y Mk1 Z Mk2 ]. (R2)
and activate
MARPA_EVENT_SYMBOL_NULLED events
for the marker symbols
(Mk1, Mk2, and Mk3),
then a MARPA_EVENT_SYMBOL_NULLED event instance
Mk0 will trigger at every location where (R2) is predicted;
Mk1 will trigger at every location where the symbol Y
in rule (R2) has been recognized,
and the symbol Z is predicted;
Mk2 will trigger at every location where (R2)
has been fully recognized, so that the entire RHS,
including both symbols Y and Z, has been recognized.
We can note that use of the marker Mk0
can be replaced by
declaring MARPA_EVENT_SYMBOL_PREDICTED event
for symbol A.
Similarly,
use of the marker Mk2
can be replaced by
declaring MARPA_EVENT_SYMBOL_COMPLETED event
for symbol A.
We discuss this more below.
See Per-rule events.