summaryrefslogtreecommitdiff
path: root/src/runner/runner.h
blob: 758ed28dcf5e7f26152acf3967167cf07552afbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include "compiler/ast-tree.h"
#include <stdint.h>

typedef struct RunnerVariable {
  AstTreeVariable *variable;
  AstTree *value;
} RunnerVariable;

typedef struct RunnerVariables {
  RunnerVariable **data;
  size_t size;
} RunnerVariables;

typedef struct RunnerVariablePages {
  RunnerVariables **data;
  size_t size;
} RunnerVariablePages;

void runnerVariablesDelete(RunnerVariables *variables);

void runnerVariablePush(RunnerVariables *variables,AstTreeVariable *variable);
void runnerVariableSetValue(RunnerVariablePages *pages,AstTreeVariable *variable,AstTree *value);
AstTree* runnerVariableGetValue(RunnerVariablePages *pages,AstTreeVariable *variable);

bool runAstTree(AstTreeRoot *root);

AstTree *runAstTreeFunction(AstTree *tree, AstTree **arguments,
                            size_t arguments_size,RunnerVariablePages *pages);

AstTree *calcAstTreeValue(AstTree *tree,RunnerVariablePages *pages);
AstTree *deepCopyAstTree(AstTree *tree);