bind-stack iterate

This commit is contained in:
John Kerl 2016-05-16 06:33:50 -04:00
parent 473b50be20
commit d81ef415ee
4 changed files with 55 additions and 13 deletions

View file

@ -1,5 +1,7 @@
noinst_LTLIBRARIES= libcontainers.la
libcontainers_la_SOURCES= \
bind_stack.c \
bind_stack.h \
dheap.c \
dheap.h \
dvector.c \

21
c/containers/bind_stack.c Normal file
View file

@ -0,0 +1,21 @@
#include <stdlib.h>
#include "lib/mlrutil.h"
#include "lib/mlr_globals.h"
#include "containers/bind_stack.h"
bind_stack_t* bind_stack_alloc() {
return NULL; // xxx stub
}
void bind_stack_free(bind_stack_t* pstack) {
}
void bind_stack_push(bind_stack_t* pstack, mlhmmv_t* pframe) {
}
void bind_stack_pop(bind_stack_t* pstack) {
}
mv_t* bind_stack_resolve(bind_stack_t* pstack, char* key) {
return NULL; // xxx stub
}

18
c/containers/bind_stack.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef BIND_STACK_H
#define BIND_STACK_H
#include "containers/mlrval.h"
#include "containers/mlhmmv.h"
// Bound & scoped variables for use in for-loops.
typedef struct _bind_stack_t {
} bind_stack_t;
bind_stack_t* bind_stack_alloc();
void bind_stack_free(bind_stack_t* pstack);
void bind_stack_push(bind_stack_t* pstack, mlhmmv_t* pframe);
void bind_stack_pop(bind_stack_t* pstack);
mv_t* bind_stack_resolve(bind_stack_t* pstack, char* key);
#endif // BIND_STACK_H

View file

@ -6,8 +6,16 @@ BUGFIXES
================================================================
TOP-OF-LIST SUMMARY
! need evaluators (new context mllhmv) for boundvars.
! need $[k] and @[k].
* for:
- bindstack container
- boundvar evaluators @ rval: pass in a bindstack. *for miller* it ought to be possible
to be better at nested-scope name resolution than stack backwalks w/ hashgets at each
step. at each level a name will have one nearest at-or-up binding or none at all.
-> hide that in the blackboxed bindstack.
- $[boundvar] and @[boundvar] evaluators.
- cookbook example: key<->val inverter
- cookbook example: komosa originals x 2
* for-variants:
?? take out the v part??
* for (k, v in $*) { if (k =~ "^f.*$") { $sum += v} }
@ -18,17 +26,10 @@ TOP-OF-LIST SUMMARY
? for (k1, k2, v in @v[]["a"][]) ? no -- easier to do this w/ cond-block @ 2nd loop
? for (k1, k2, v in @*)
? break/continue: fully support or eliminate from the lexer/parser
* for:
- bindstack container
- boundvar evaluators @ rval: pass in a bindstack. *for miller* it ought to be possible
to be better at nested-scope name resolution than stack backwalks w/ hashgets at each
step. at each level a name will have one nearest at-or-up binding or none at all.
-> hide that in the blackboxed bindstack.
- $[boundvar] and @[boundvar] evaluators.
- cookbook example: key<->val inverter
- cookbook example: komosa originals x 2
* local vars w/ decl syntax
* user-defined functions ... ??
? local vars w/ decl syntax
? user-defined functions ... ??
* eliminate the need for semicolon after curly brace. for now, highlighted faqent.
* cst-time parse validations: top-level-only begin/end (done); no $stuff at begin/end.
? triple-for with boundvars??