const adjustments to ll backend

This commit is contained in:
Sven M. Hallberg 2013-04-30 17:48:24 +02:00
parent 209bd43f10
commit 296ffb87b6

View file

@ -104,7 +104,7 @@ static void collect_nts(HCFGrammar *grammar, HCFChoice *symbol)
} }
/* Does the given symbol derive the empty string (under g)? */ /* Does the given symbol derive the empty string (under g)? */
bool h_symbol_derives_epsilon(HCFGrammar *g, HCFChoice *symbol) bool h_symbol_derives_epsilon(HCFGrammar *g, const HCFChoice *symbol)
{ {
if(g->geneps == NULL) if(g->geneps == NULL)
collect_geneps(g); collect_geneps(g);
@ -121,7 +121,7 @@ bool h_symbol_derives_epsilon(HCFGrammar *g, HCFChoice *symbol)
} }
/* Does the sentential form given by s derive the empty string? */ /* Does the sentential form given by s derive the empty string? */
bool h_sequence_derives_epsilon(HCFGrammar *g, HCFSequence *s) bool h_sequence_derives_epsilon(HCFGrammar *g, const HCFSequence *s)
{ {
// return true iff all symbols in s derive epsilon // return true iff all symbols in s derive epsilon
HCFChoice **x; HCFChoice **x;
@ -150,7 +150,7 @@ static void collect_geneps(HCFGrammar *g)
HHashTableEntry *hte; HHashTableEntry *hte;
for(i=0; i < g->nts->capacity; i++) { for(i=0; i < g->nts->capacity; i++) {
for(hte = &g->nts->contents[i]; hte; hte = hte->next) { for(hte = &g->nts->contents[i]; hte; hte = hte->next) {
HCFChoice *symbol = hte->key; const HCFChoice *symbol = hte->key;
// only "choice" nonterminals can derive epsilon. // only "choice" nonterminals can derive epsilon.
if(symbol->type != HCF_CHOICE) if(symbol->type != HCF_CHOICE)