Previous: , Up: LHS terminals   [Contents][Index]


32.1.5 Nulling terminals

When LHS terminals are not in use, nulling terminals cannot occur, and applications need not take them in account. This is because, in order to be nullable, a symbol must appear on the LHS of a nullable rule. Without LHS terminals, therefore, no terminals can ever be either nullable or nulling.

Things become more complicated if LHS terminals are allowed. In that case nulling terminals can be created, and Libmarpa must take measures to prevent a recognizer from being created for a grammar with nulling terminals. Libmarpa will not allow a recognizer to be created from a grammar with nulling terminals because they are a logical contradiction. A terminal is (by definition) a symbol which can appear in the input, and a nulling symbol, by definition, cannot appear in the input.

Libmarpa’s marpa_g_precompute method fails with the error code MARPA_ERR_NULLING_TERMINAL if it detects nulling terminals during precomputation. The error code MARPA_ERR_NULLING_TERMINAL is library-recoverable. See marpa_g_precompute().

Libmarpa’s marpa_g_precompute method also triggers one MARPA_EVENT_NULLING_TERMINAL event for every nulling terminal in the grammar. This implies that one or more MARPA_EVENT_NULLING_TERMINAL events occur iff marpa_g_precompute fails with error code MARPA_ERR_NULLING_TERMINAL.