From 1c8cbfd09ff9dd02f6d8d938c45e3f29a35f6f32 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 5 Feb 2022 23:23:03 +0800 Subject: predicates start working now Now we have a working implementation of predicates. It now only remains to write the parser of grammars. Of course we shall generate this parser by this parser generator itself, because why not. ;-P --- src/grammar.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/grammar.h') diff --git a/src/grammar.h b/src/grammar.h index e18ad0e..89a66ba 100644 --- a/src/grammar.h +++ b/src/grammar.h @@ -78,6 +78,8 @@ 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); +BOOL ptd_run(PTD *p, NUM code); + /* If a TNT of type TERMINAL has value END_OF_INPUT, then it means, surprisingly, the end of input. */ enum { END_OF_INPUT = -1 }; @@ -172,6 +174,9 @@ List *grammar_names(CCR_MOD(Grammar *)g); /* look up a rule */ Rule_group *grammar_rule(CCR_MOD(Grammar *) g, NT nt); +/* lookup a predicate */ +PTD *grammar_ptd(CCR_MOD(Grammar *) g, PT pt); + /* NTS should be already allocated to be an array of BOOLs. The size of this array should be the same as the length of the array of non-terminals of G. If any of the above two conditions is not -- cgit v1.2.3-18-g5258