summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/data.h
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-10-09 08:38:55 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-10-09 08:38:55 +0000
commit6c86e7fa91602e4863c95622934d45e383890156 (patch)
tree6f8e65171ecf5084e9a9b9c54fbcab60b29b3e2f /src/runtime/c/pgf/data.h
parent84b257e85ca15b36e897df8701f66c57064fde97 (diff)
replace the hash maps in the abstract syntax with binary search tables
Diffstat (limited to 'src/runtime/c/pgf/data.h')
-rw-r--r--src/runtime/c/pgf/data.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/runtime/c/pgf/data.h b/src/runtime/c/pgf/data.h
index ac319c59f..34e8ddb16 100644
--- a/src/runtime/c/pgf/data.h
+++ b/src/runtime/c/pgf/data.h
@@ -13,9 +13,16 @@ extern GU_DECLARE_TYPE(PgfCCat, abstract);
typedef GuSeq PgfCCats;
-#define PgfCIdMap GuStringMap
-typedef PgfCIdMap PgfFlags; // PgfCId -> PgfLiteral
-extern GU_DECLARE_TYPE(PgfFlags, GuMap);
+#define PgfCIdMap GuStringMap
+
+typedef struct {
+ PgfCId name;
+ PgfLiteral value;
+} PgfFlag;
+
+typedef GuSeq PgfFlags;
+
+extern GuOrder pgf_flag_order[1];
// PgfPatt
@@ -87,7 +94,9 @@ typedef struct {
} closure;
} PgfAbsFun;
-extern GU_DECLARE_TYPE(PgfAbsFun, abstract);
+typedef GuSeq PgfAbsFuns;
+
+extern GuOrder pgf_absfun_order[1];
typedef GuMap PgfMetaChildMap;
extern GU_DECLARE_TYPE(PgfMetaChildMap, GuMap);
@@ -103,13 +112,18 @@ typedef struct {
extern GU_DECLARE_TYPE(PgfAbsCat, abstract);
+typedef GuSeq PgfAbsCats;
+
+extern GuOrder pgf_abscat_order[1];
+
+
typedef struct PgfEvalGates PgfEvalGates;
typedef struct {
PgfCId name;
PgfFlags* aflags;
- PgfCIdMap* funs; // |-> PgfAbsFun*
- PgfCIdMap* cats; // |-> PgfAbsCat*
+ PgfAbsFuns* funs;
+ PgfAbsCats* cats;
PgfAbsFun* abs_lin_fun;
PgfEvalGates* eval_gates;
} PgfAbstr;
@@ -130,12 +144,16 @@ typedef enum {
PGF_INSTR_FAIL = 14
} PgfInstruction;
+typedef GuSeq PgfConcrs;
+
+extern GuOrder pgf_concr_order[1];
+
struct PgfPGF {
uint16_t major_version;
uint16_t minor_version;
PgfFlags* gflags;
PgfAbstr abstract;
- PgfCIdMap* concretes; // |-> PgfConcr*
+ PgfConcrs* concretes;
GuPool* pool; // the pool in which the grammar is allocated
};
@@ -269,7 +287,6 @@ struct PgfConcr {
GuFinalizer fin; // and this is the finalizer in the pool of the whole grammar
};
-extern GU_DECLARE_TYPE(PgfConcr, abstract);
// PgfProduction