From 53b8b6ffab5a968db75e9babddf4e2dbb2c688a3 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 9 Nov 2021 20:03:23 +0800 Subject: save point: representation of grammar might be too rough. The current representation of the grammar is the most primitive BNF. This is the simplest to implement, but is difficult to cope with user requirements. Moreover, I find another paper describing the GLR algorithm, so I need to think about the representation of the grammar more. In particular, I would like the generation of the grammar to be incremental, so per chance its data type should be adapted accordingly. --- src/reader.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/reader.c') diff --git a/src/reader.c b/src/reader.c index 018d9c7..4bbcf5a 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1 +1,20 @@ -#include "input.h" +#include "reader.h" + +struct Reader_s { + reader_func_t func; + List *args; /* the list of arguments; could be + NULL. */ +}; + +void build_reader(Reader *reader, reader_func_t func, List *args) +{ + reader->func = func; + reader->args = args; +} + +void destroy_reader(Reader *reader, int flag) +{ + destroy_list(reader->args, flag); + reader->args = NULL; + reader->func = NULL; +} -- cgit v1.2.3-18-g5258