libsapling  0.8.0
grammar.h
Go to the documentation of this file.
1 #ifndef _LIBSAPLING_PARSER_GRAMMAR_H_
2 #define _LIBSAPLING_PARSER_GRAMMAR_H_
3 
9 #include "libsapling/dm/graph.h"
10 
11 typedef struct grammar *grammar_t;
12 
13 
23 grammar_t new_grammar(node_t *productions, int num_terminals, int num_symbols);
24 
29 void delete_grammar(grammar_t g);
30 
35 node_t *grammar__productions(grammar_t g);
36 
41 int grammar__num_terminals(grammar_t g);
42 
47 int grammar__num_nonterminals(grammar_t g);
48 
54 int grammar__num_symbols(grammar_t g);
55 
60 int grammar__is_terminal(grammar_t g, int symbol);
61 
62 #endif
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.
void delete_grammar(grammar_t g)
Frees the memory previously allocated on the heap for a grammar with new_grammar.
int grammar__is_terminal(grammar_t g, int symbol)
Returns whether the symbol is a terminal in the grammar.
int grammar__num_symbols(grammar_t g)
Returns the sum of the number of terminals and nonterminals in the grammar.
grammar_t new_grammar(node_t *productions, int num_terminals, int num_symbols)
Allocates a new grammar on the heap.
int grammar__num_nonterminals(grammar_t g)
Returns the number of nonterminals in the grammar.
Graph implementation.