Next: , Previous: , Up: Nullability   [Contents][Index]


13.2 Assigning semantics to nulled symbols

Libmarpa leaves the semantics to an upper layer, so that we usually treat semantics as outside the scope of this document. But most upper layers will find that nulled symbols are a corner case for their semantics, and we therefore offer the writers of upper layers some hints.

Typically, upper layers will assign semantics to a LHS symbol based on the rule instance in which the LHS occurs. All nulled symbols are LHS symbols, but the valuator prunes all nulled rules, forcing the application to determine the semantics of a nulled symbol instance based on its symbol. One method of making this determination is the one which is implemented in Marpa::R2. Let g be a grammar; and let x be a symbol that is nulled in a parse that uses g. Call a rule in g with x on its LHS, an “x LHS rule”. Marpa::R2 assigns a semantics to x using the first of following guidelines that applies: