Next: , Previous: , Up: Grammar methods   [Contents][Index]


18.1 Overview

An archetypal application has a grammar. To create a grammar, use the marpa_g_new() method. When a grammar is no longer in use, its memory can be freed using the marpa_g_unref() method.

To be precomputed, a grammar must have one or more symbols. To create symbols, use the marpa_g_symbol_new() method.

To be precomputed, a grammar must have one or more rules. To create rules, use the marpa_g_rule_new() and marpa_g_sequence_new() methods.

To be precomputed, a grammar must have exactly one start symbol. To mark a symbol as the start symbol, use the marpa_g_start_symbol_set() method.

Before parsing with a grammar, it must be precomputed. To precompute a grammar, use the marpa_g_precompute() method.