diff options
author | JSDurand <mmemmew@gmail.com> | 2022-02-01 12:22:34 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2022-02-01 12:22:34 +0800 |
commit | 3fb5430080199a6d92a63f8259fe4a88df9b83ba (patch) | |
tree | 767c3266b59566e98234ec81b228cf8115096939 /src/grammar.h | |
parent | eb007d554251456a2a508849edf91b15aab1333e (diff) |
need to stop abusing hash tables
Hash tables take too much space!
If I use hash tables, the length of the input will be severely
limited, to an unacceptable extent. So we have to use arrays
instead.
Diffstat (limited to 'src/grammar.h')
-rw-r--r-- | src/grammar.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/grammar.h b/src/grammar.h index d51c612..fd8d5c9 100644 --- a/src/grammar.h +++ b/src/grammar.h @@ -55,7 +55,7 @@ typedef unsigned long PT; * PT_DFA, * PT_SPECIAL * }; - * + * * typedef enum PT_TYPE_e PT_TYPE; */ /* T or NT @@ -70,6 +70,14 @@ enum TNT_TYPE_e { typedef enum TNT_TYPE_e TNT_TYPE; +typedef struct PT_DATA_s PTD; + +/* On error return NULL */ +PTD *new_ptd(str *user_name, str *raw_name, dfa *dfap); + +/* FLAG is used to destroy the strings contained within */ +void destroy_ptd(PTD *p, int flag); + /* If a TNT of type TERMINAL has value END_OF_INPUT, then it means, surprisingly, the end of input. */ enum { END_OF_INPUT = -1 }; @@ -98,8 +106,8 @@ typedef struct Grammar_s Grammar; NAMES is a list of CPA pointers. */ BOOL -build_grammar(Grammar *g, - const List *rules, CC_MOD(List *) names); +build_grammar(Grammar *g, const List *rules, + CC_MOD(List *) names, CC_MOD(List *) predicates); /* This accepts one and only one optional argument, which is of type either T, NT, or PT, depending on TYPE. */ |