summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-04-10 10:37:51 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-04-10 10:37:51 -0700
commit48d917f2f18f91e418189b7fc41f7a9651e40b42 (patch)
tree4c9dcef7bf3fc63f86d3348972c9574cc5f5ae5b /lib.h
parent40211feffd1af2164674b1b4aa01f38197f75336 (diff)
downloadtxr-48d917f2f18f91e418189b7fc41f7a9651e40b42.tar.gz
txr-48d917f2f18f91e418189b7fc41f7a9651e40b42.tar.bz2
txr-48d917f2f18f91e418189b7fc41f7a9651e40b42.zip
parser: eliminate struct list_accum.
As a final round of this recent work, we observe that since the accumulator structure has been reduced to two members, we can eliminate one of them by using a cons cell as the accumulator, and threading the second value through the cdr. That is to say, the listacc grammar rule's semantic value will now be the tail cons of the list being constructed. The cdr of this cons will, temporarily, be a back pointer to the head (making the list temporarily circular). The n_exprs reduction will fix this up; it will put the correct terminating atom in place of the head (either nil, or the dotted item if there is one), and yield the head as the semantic value. * lib.h (struct list_accum): Removed. (Thus, finding a better home for this would, after all, have been a waste of time). * parser.y (lacc, splacc): Static functions removed. (union YYSTYPE): lacc membber removed. (n_exprs): Adjust to new semantic value coming from listacc. (listacc): Now of type val again. Yields pointer to tail cons as semantic value, whose cdr points to the head of the list.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/lib.h b/lib.h
index 9002fd11..f039568f 100644
--- a/lib.h
+++ b/lib.h
@@ -337,11 +337,6 @@ union obj {
struct dyn_args a;
};
-struct list_accum {
- obj_t *head;
- obj_t *tail;
-};
-
#if CONFIG_GEN_GC
typedef struct {
val *ptr;