summaryrefslogtreecommitdiff
path: root/src/runtime/c/pgf/evaluator.h
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-10-31 14:16:11 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-10-31 14:16:11 +0000
commitb1e6a21c56c5aef62716c35546d4596e11bbbf94 (patch)
tree2436602f1eb48f198ebab5ad389a4ea027415f8d /src/runtime/c/pgf/evaluator.h
parent9b0f354c7cef175c172edae582dcfa48817db7ba (diff)
now (+) in the abstract syntax works, i.e. it knows how to deal with partial sums
Diffstat (limited to 'src/runtime/c/pgf/evaluator.h')
-rw-r--r--src/runtime/c/pgf/evaluator.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/runtime/c/pgf/evaluator.h b/src/runtime/c/pgf/evaluator.h
index 1f56d61a9..39d43559d 100644
--- a/src/runtime/c/pgf/evaluator.h
+++ b/src/runtime/c/pgf/evaluator.h
@@ -15,9 +15,17 @@ typedef struct {
PgfEvalGates* eval_gates; // cached from pgf->abstr->eval_gates
GuPool* pool;
GuExn* err;
+ void* enter_stack_ptr;
+ void* tmp; // for temporary register spills
PgfIndirection cafs[]; // derived from gu_seq_data(pgf->abstr->eval_gates->cafs)
} PgfEvalState;
+typedef struct {
+ PgfLiteral lit;
+ GuBuf* consts;
+ void* enter_stack_ptr;
+} PgfEvalAccum;
+
typedef struct PgfEnv PgfEnv;
struct PgfEnv {
@@ -55,6 +63,12 @@ typedef struct {
typedef struct {
PgfClosure header;
+ PgfLiteral lit;
+ GuBuf* consts;
+} PgfValueSum;
+
+typedef struct {
+ PgfClosure header;
PgfClosure* fun;
size_t n_args;
PgfClosure* args[];
@@ -70,6 +84,7 @@ struct PgfEvalGates {
PgfFunction evaluate_value_const;
PgfFunction evaluate_meta;
PgfFunction evaluate_gen;
+ PgfFunction evaluate_sum;
PgfFunction evaluate_caf;
PgfFunction update_closure;
@@ -90,4 +105,23 @@ PgfClosure*
pgf_evaluate_lambda_application(PgfEvalState* state, PgfExprThunk* lambda,
PgfClosure* arg);
+void
+pgf_evaluate_accum_init_int(PgfEvalState* state,
+ PgfEvalAccum* accum, int val);
+
+void
+pgf_evaluate_accum_init_str(PgfEvalState* state,
+ PgfEvalAccum* accum, GuString val);
+
+void
+pgf_evaluate_accum_init_flt(PgfEvalState* state,
+ PgfEvalAccum* accum, float val);
+
+void
+pgf_evaluate_accum_add(PgfEvalState* state,
+ PgfEvalAccum* accum, PgfClosure* closure);
+
+PgfClosure*
+pgf_evaluate_accum_done(PgfEvalState* state, PgfEvalAccum* accum);
+
#endif