diff options
author | JSDurand <mmemmew@gmail.com> | 2021-11-09 20:03:23 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2021-11-09 20:03:23 +0800 |
commit | 53b8b6ffab5a968db75e9babddf4e2dbb2c688a3 (patch) | |
tree | 4ff55ae0027544b06702d24ec4840a2011f724e9 /src/list.c | |
parent | 87b6bad500702b0fcd708ee5b1d99f61a29ec7e6 (diff) |
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.
Diffstat (limited to 'src/list.c')
-rw-r--r-- | src/list.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -108,6 +108,16 @@ map_list(List *ls, acter f) f(*(ls->array+i)); } +H_ATTR +void +map_list_between(List *ls, acter f, doer d) +{ + for (NUM i = 0; i < ls->len; i++) { + f(*(ls->array+i)); + if (i + 1 < ls->len) d(); + } +} + void print_list(List *ls, printer prt) { |