add h_cfgrammar_free()

This commit is contained in:
Sven M. Hallberg 2013-05-08 18:02:35 +02:00
parent 65ee3593bd
commit 9f5c32e205
2 changed files with 18 additions and 0 deletions

View file

@ -11,6 +11,7 @@ typedef struct HCFGrammar_ {
HHashTable *first; // memoized first sets of the grammar's symbols
HHashTable *follow; // memoized follow sets of the grammar's NTs
HArena *arena;
HAllocator *mm__;
} HCFGrammar;
/* mapping input bytes or end to tokens
@ -29,6 +30,11 @@ static const HCFToken end_token = 0x200;
*/
HCFGrammar *h_cfgrammar(HAllocator* mm__, const HParser *parser);
/* Frees the given grammar and associated data.
* Does *not* free parsers' CFG forms as created by h_desugar.
*/
void h_cfgrammar_free(HCFGrammar *g);
/* Does the given symbol derive the empty string (under g)? */
bool h_symbol_derives_epsilon(HCFGrammar *g, const HCFChoice *symbol);