libsapling
0.8.0
|
Grammar implementation. More...
#include "libsapling/dm/graph.h"
Go to the source code of this file.
Typedefs | |
typedef struct grammar * | grammar_t |
Functions | |
grammar_t | new_grammar (node_t *productions, int num_terminals, int num_symbols) |
Allocates a new grammar on the heap. More... | |
void | delete_grammar (grammar_t g) |
Frees the memory previously allocated on the heap for a grammar with new_grammar. | |
node_t * | grammar__productions (grammar_t g) |
Returns the grammar's path of productions. More... | |
int | grammar__num_terminals (grammar_t g) |
Returns the number of terminals in the grammar. More... | |
int | grammar__num_nonterminals (grammar_t g) |
Returns the number of nonterminals in the grammar. More... | |
int | grammar__num_symbols (grammar_t g) |
Returns the sum of the number of terminals and nonterminals in the grammar. More... | |
int | grammar__is_terminal (grammar_t g, int symbol) |
Returns whether the symbol is a terminal in the grammar. More... | |
Grammar implementation.
int grammar__is_terminal | ( | grammar_t | g, |
int | symbol | ||
) |
Returns whether the symbol is a terminal in the grammar.
int grammar__num_nonterminals | ( | grammar_t | g | ) |
Returns the number of nonterminals in the grammar.
int grammar__num_symbols | ( | grammar_t | g | ) |
Returns the sum of the number of terminals and nonterminals in the grammar.
int grammar__num_terminals | ( | grammar_t | g | ) |
Returns the number of terminals in the grammar.
node_t* grammar__productions | ( | grammar_t | g | ) |
Returns the grammar's path of productions.
grammar_t new_grammar | ( | node_t * | productions, |
int | num_terminals, | ||
int | num_symbols | ||
) |
Allocates a new grammar on the heap.
productions | Path of productions. |
num_terminals | Number of terminals. |
num_symbols | Sum of the number of terminal and nonterminal symbols. |