diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-09 23:05:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-09 23:13:48 -0700 |
commit | 1f92a0580ad9539f92ac788b92dd12bb7db171e1 (patch) | |
tree | 66030dad644acf83db0613b78ad44eed7fe3c963 /lib.h | |
parent | 62c2d365464a526e142de31c5895d3d9e53875ee (diff) | |
download | txr-1f92a0580ad9539f92ac788b92dd12bb7db171e1.tar.gz txr-1f92a0580ad9539f92ac788b92dd12bb7db171e1.tar.bz2 txr-1f92a0580ad9539f92ac788b92dd12bb7db171e1.zip |
parser: streamline core list building.
The r_expr grammar symbol is replaced with listacc which has
a different type: a new Yacc node type that has three fields
for building a list from left to right without nreverse,
and the dotted pair item.
* lib.h (struct list_accum): New struct type. Not a great
place for it, but we don't have a parser-specific header that
is included before y.tab.h: parser.h is included after
y.tab.h.
* parser.y (misplaced_consing_dot_check): The val argument
is just the existing dotted item; if it is other than nao,
the error is generated.
(lacc, splacc): New static functions.
(YYSTYPE): New union member, lacc of type struct list_accum.
(r_exprs): Grammar symbol removed.
(listacc): New grammar symbol of type listacc. The rules are
those of r_exprs upgraded to construct the list in one pass.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -337,6 +337,12 @@ union obj { struct dyn_args a; }; +struct list_accum { + obj_t *head; + obj_t *tail; + obj_t *dot; +}; + #if CONFIG_GEN_GC typedef struct { val *ptr; |