diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-10 10:37:51 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-10 10:37:51 -0700 |
commit | 48d917f2f18f91e418189b7fc41f7a9651e40b42 (patch) | |
tree | 4c9dcef7bf3fc63f86d3348972c9574cc5f5ae5b /lib.h | |
parent | 40211feffd1af2164674b1b4aa01f38197f75336 (diff) | |
download | txr-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.h | 5 |
1 files changed, 0 insertions, 5 deletions
@@ -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; |