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


11.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.

For non-trivial parsing, one or more of the symbols must be terminals. To mark a symbol as a terminal, use the marpa_g_symbol_is_terminal_set() method.

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.