a partial support for def rules in the C runtime

The def rules are now compiled to byte code by the compiler and then to
native code by the JIT compiler in the runtime. Not all constructions
are implemented yet. The partial implementation is now in the repository
but it is not activated by default since this requires changes in the
PGF format. I will enable it only after it is complete.
This commit is contained in:
kr.angelov
2014-08-11 10:59:10 +00:00
parent 02dda1e66f
commit 584d589041
37 changed files with 707 additions and 455 deletions

View File

@@ -5,21 +5,64 @@
#include <gu/mem.h>
#include <gu/in.h>
typedef struct PgfReader PgfReader;
// general reader interface
typedef struct {
GuIn* in;
GuExn* err;
GuPool* opool;
GuPool* tmp_pool;
struct PgfJitState* jit_state;
} PgfReader;
PgfReader*
pgf_new_reader(GuIn* in, GuPool* opool, GuPool* tmp_pool, GuExn* err);
uint8_t
pgf_read_tag(PgfReader* rdr);
uint32_t
pgf_read_uint(PgfReader* rdr);
int32_t
pgf_read_int(PgfReader* rdr);
GuString
pgf_read_string(PgfReader* rdr);
double
pgf_read_double(PgfReader* rdr);
size_t
pgf_read_len(PgfReader* rdr);
PgfCId
pgf_read_cid(PgfReader* rdr, GuPool* pool);
PgfPGF*
pgf_read_pgf(PgfReader* rdr);
void
pgf_concrete_load(PgfConcr* concr, GuIn* in, GuExn* err);
void
pgf_concrete_unload(PgfConcr* concr);
void
pgf_reader_done(PgfReader* rdr, PgfPGF* pgf);
// JIT specific interface
typedef struct PgfJitState PgfJitState;
PgfJitState*
pgf_new_jit(PgfReader* rdr);
void
pgf_jit_predicate(PgfReader* rdr, PgfAbstr* abstr,
PgfAbsCat* abscat);
void
pgf_jit_function(PgfReader* rdr, PgfAbstr* abstr,
PgfAbsFun* absfun);
void
pgf_jit_done(PgfReader* state, PgfAbstr* abstr);
#endif // READER_H_