finish engine merging

This commit is contained in:
Sven M. Hallberg 2013-06-22 17:40:47 +02:00
parent 23afea4b4e
commit 67681a119a
4 changed files with 168 additions and 119 deletions

View file

@ -69,18 +69,18 @@ typedef struct HLREnhGrammar_ {
typedef struct HLREngine_ {
const HLRTable *table;
size_t state;
bool run;
HSlist *stack; // holds pairs: (saved state, semantic value)
HInputStream input;
struct HLREngine_ *merged; // ancestor merged into this engine at mp
HSlistNode *mp; // mergepoint: stack->head at time of merge
struct HLREngine_ *merged[2]; // ancestors merged into this engine
HArena *arena; // will hold the results
HArena *tarena; // tmp, deleted after parse
} HLREngine;
#define HLR_SUCCESS ((size_t)~0) // parser end state
// XXX move to internal.h or something
// XXX replace other hashtable iterations with this
@ -131,7 +131,7 @@ int h_lalr_compile(HAllocator* mm__, HParser* parser, const void* params);
void h_lalr_free(HParser *parser);
const HLRAction *h_lrengine_action(const HLREngine *engine);
void h_lrengine_step(HLREngine *engine, const HLRAction *action);
bool h_lrengine_step(HLREngine *engine, const HLRAction *action);
HParseResult *h_lrengine_result(HLREngine *engine);
HParseResult *h_lr_parse(HAllocator* mm__, const HParser* parser, HInputStream* stream);
HParseResult *h_glr_parse(HAllocator* mm__, const HParser* parser, HInputStream* stream);